Invalid TraceListenerData type in configuration for listenerDataType

Topics: Building and extending application blocks, Logging Application Block
Feb 6, 2013 at 3:53 PM
Hi,

I am working on the Extending of Enterprise Library 5.0 Logging Application Block to store the Log in to the database. For customization I am inheriting the a class TraceListenerData and FormattedTraceListenerBase and created an assembly. I have referred same in my application and added respective entries to the app.config.

I am getting the ConfigurationErrorException. The exception details are as follows:

{"Invalid TraceListenerData type in configuration 'listenerDataType=\"Logger.ExtendedPropertyDatabaseListener.ExtendedFormattedDatabaseTraceListenerData,Logger.ExtendedPropertyDatabaseListener, Version=1.0.0.0, Culture=neutral\"'. (<Code file path> line 11)"}.

Please let me know, how to configure the ExtendedFormattedDatabaseTraceListenerData.

Thanks in advance.
Ramesh
Feb 7, 2013 at 5:14 AM
I'm assuming this is a runtime error. The solution is to ensure that the Logger.ExtendedPropertyDatabaseListener.dll assembly can be located by the CLR. Usually this would be in the bin or bin\debug, bin\release or other deployment folder. Two reasons why the assembly might not be in the required folder are that the assembly might not be copied if it is not referenced by the project or if Copy Local for the reference is false.

~~
Randy Levy
entlib.support@live.com
Enterprise Library support engineer
Support How-to
Feb 7, 2013 at 5:41 AM
Hi,

Thanks for your quick response. The assembly is rightly placed in the bin\debug folder and I have checked property of the assembly copy local is set to true only.

Not sure, where it is going wrong.

Thanks,
Ramesh
Feb 7, 2013 at 5:51 AM
Is the class name, Logger.ExtendedPropertyDatabaseListener.ExtendedFormattedDatabaseTraceListenerData, correct? Also, the project should target the .NET Framework and not .NET Framework Client Profile.

You can use Fuslogvw.exe (Assembly Binding Log Viewer) to troubleshoot binding issues.

~~
Randy Levy
entlib.support@live.com
Enterprise Library support engineer
Support How-to
Feb 7, 2013 at 10:56 AM
Hi,

Thank you very much, I was able to found the issue using Fuslogvew.exe. It was very helpful in fixing the problem. While executing the logger I am getting another exception. The exception is as follows:

Resolution of the dependency failed, type = "Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter", name = "(none)".
Exception occurred while: while resolving.
Exception is: InvalidOperationException - The type Database does not have an accessible constructor.

The above exception occurred when I am trying to log the entry with LogWritter. The code is as follows:

var container = new UnityContainer();
container.AddNewExtension<EnterpriseLibraryCoreExtension>();

var logWriter = container.Resolve<LogWriter>();

logWriter.Write("First entry", "Demo");

Please let me know, if I am missing any configuration entries in the configuration. I have already placed the configsection for Dataconfiguration and provided the connectionstring for database in the app.config file.

Thanks in advance.

Thanks,
Ramesh
Feb 7, 2013 at 11:26 AM
Hi,

Thanks for your support, I found the issue. This is basically, need to add an entry to the configuration file.

<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <qualifyAssembly partialName="Microsoft.Practices.EnterpriseLibrary.Data" fullName="Microsoft.Practices.EnterpriseLibrary.Data, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</assemblyBinding>
</runtime>

I found the above, in a different post, where you have mentioned this. Once again thanks a lot.

Thanks,
Ramesh