Invalid TraceListenerData type in configuration

Topics: Building and extending application blocks, Logging Application Block
Aug 19, 2008 at 8:57 AM

I get this following error while executing my application which is configured to Database Trace Listener using Enterprise Application Block 4.0. I have referenced Microsoft.Practices.EnterpriseLibrary.Logging.Database.dll in my project and still it gives the same error. Please help me to resolve it.

System.Configuration.ConfigurationErrorsException was unhandled
  Message="Invalid TraceListenerData type in configuration 'listenerDataType=\"Microsoft.Practices.EnterpriseLibrary.Logging.Database.Configuration.FormattedDatabaseTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35\"'. (C:\\Users\\imayak\\Documents\\Visual Studio 2008\\Projects\\TestSSPWindows\\TestSSPWindows\\bin\\Debug\\TestSSPWindows.vshost.exe.Config line 16)"
  BareMessage="Invalid TraceListenerData type in configuration 'listenerDataType=\"Microsoft.Practices.EnterpriseLibrary.Logging.Database.Configuration.FormattedDatabaseTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35\"'."
  Filename="C:\\Users\\imayak\\Documents\\Visual Studio 2008\\Projects\\TestSSPWindows\\TestSSPWindows\\bin\\Debug\\TestSSPWindows.vshost.exe.Config"
       at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.EnterpriseLibraryFactory.BuildUp[T](IReadWriteLocator locator, ILifetimeContainer lifetimeContainer, IConfigurationSource configurationSource)
       at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.EnterpriseLibraryFactory.BuildUp[T](IConfigurationSource configurationSource)
       at Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterFactory.Create()
       at Common.SSPLogger.Initialize() in C:\Users\imayak\Documents\Visual Studio 2008\Projects\Solution1\Common\SSPLogger.cs:line 44
       at Common.SSPLogger.Write(SSPException sspException) in C:\Users\imayak\Documents\Visual Studio 2008\Projects\Solution1\Common\SSPLogger.cs:line 152
       at TestSSPWindows.Form2.btnAsyncLogging_Click(Object sender, EventArgs e) in C:\Users\imayak\Documents\Visual Studio 2008\Projects\TestSSPWindows\TestSSPWindows\Form2.cs:line 28
       at System.Windows.Forms.Control.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ButtonBase.WndProc(Message& m)
       at System.Windows.Forms.Button.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.Run(Form mainForm)
       at TestSSPWindows.Program.Main() in C:\Users\imayak\Documents\Visual Studio 2008\Projects\TestSSPWindows\TestSSPWindows\Program.cs:line 17
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()

Aug 19, 2008 at 2:10 PM

Hi Imaya,

You mention you added a reference to the Logging.Database assembly, but you don't state the project to which you added this reference. I can see different namespaces in you stack trace (TestSSPWindows and Common.SSPLogger) hinting more than one assembly.

You need to make sure the Logging.Database assembly is available to your app; this thread describes the situation in detail


Aug 24, 2008 at 1:18 PM
Hey Fernando,

As always, you helped me this time too. I read through the link that you mentioned and referenced the logging.database.dll to the Windows Application(TestSSPWindows) too and it started working. I think this is because the framework is not able to find the referenced logging.database.dll in the bin directory of the Windows App.  Thanks for your help.
Aug 25, 2008 at 12:03 PM

It's not that the framework can't find the assembly, but that the build process will not copy it; the last couple of posts in the thread I linked before contain a detailed explanation of how this works, and why.

Feb 2, 2011 at 6:40 PM

I actually read thru the link  you have mentioned in the post dated Aug 19,2008.

It almost made sense and solved my problem of Invalid TraceListenerData type.

Thanks for your explanation.

Feb 28, 2011 at 9:00 PM

Ran into a similar issue described above, but with Enterprise Library version 5 (5.0.414.0), and it drove me nuts!  I had used Ent Lib several times, but this app was a little different, since it was a console application.  In any case,  I added all the correct references, but still got the invalid TraceListenerDataType.  I found the answer here:

Incase that blog ever disappears, my console app targets .net 4.  Check the target framework of your compiler, ensure its .NET Framework 4, and NOT .NET Framework 4 Client Profile.  I dont know what the difference between the 2 is, but changing it to .NET Framework 4 solved my issue (and the subsequent headache that was accompanying my issue).


Mar 1, 2011 at 12:26 AM

Thanks for sharing ewitkows :)

Btw, related issue for this has already been logged and can be found in the Issue Tracker, you can vote for it. Thanks :)

Gino Terrado
Global Technologies and Solutions
Avanade, Inc.

May 14, 2011 at 9:37 PM

Thanks for the hint ewitkows.