Issue with Custom Trace listener in MsmqDistributor.exe in Entlib 5.0

Topics: Logging Application Block
Jun 11, 2014 at 10:28 PM
Hi,

I am facing the same issue here, could not find a solution yet. Could anyone can help me resolve it ASAP

I am trying to have a custom trace listener to log the details to database. if i build the project either in VS2010/2012, the MsmqDistributor Service is not starting at results in error.

MsmqDistributor.exe in 5.414 is not accepting a custom trace listener. We are migrating all VS2010 project o VS2012 projects. If i build the dll targeting 4.5 i receive the same error.

An error occurred creating the configuration section handler for loggingConfiguration: Could not load file or assembly 'XXXXXXXX, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded. (C:\Program Files (x86)\Microsoft Enterprise Library 5.0\Bin\MsmqDistributor.exe.Config line 8)
BareMessage: An error occurred creating the configuration section handler for loggingConfiguration: Could not load file or assembly ‘XXXXXXXXX, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.

I have also tried building the enterprise libary source, but its not solving the issue either.

Thanks.
Jun 16, 2014 at 6:20 AM
The MSMQ Distributor Service executable targets .NET 2.0.50727 which I believe would be .NET 3.5 SP1. If you build your custom assembly targeting .NET 3.5 does that help? If you try to rebuild MSMQ Distributor you will also need to rebuild Enterprise Library Logging (and its dependencies) and have all applications who are writing to the queue change their references to use the newly compiled version (otherwise you will hit deserialization issues).

~~
Randy Levy
entlib.support@live.com
Enterprise Library support engineer
Support How-to
Jun 16, 2014 at 1:39 PM
Yes i have rebuild the MSMQ Distributor.exe targeting 4.0, but still receiving the error. After rebuilding i was facing signed assembly issue and i was able to resolve it by signing the logging and common projects.

But loading a custom listener is not working.

any guidence will the helpful.

Thanks
Jun 17, 2014 at 6:18 AM
I would recommend using the out-of-the-box MSMQ Distributor service along with a custom trace listener built targeting .NET Framework 3.5.

If I try to use a custom listener built targeting .NET 4.0 I can reproduce the behavior you are describing. If I switch to targeting .NET Framework 3.5 the issue is resolved. When I run ILDASM customtracelistener.dll on the working assembly and look at the manifest the first line should be "// Metadata version: v2.0.50727" which indicates that it is targeting .NET 3.5. If it shows "// Metadata version: v4.0.30319" then it will not work.

~~
Randy Levy
entlib.support@live.com
Enterprise Library support engineer
Support How-to
Jun 23, 2014 at 7:03 PM
Quick update.

I was able to resolve the issue by building the enterprise library in VS2012 targeting 4.0. Installed the MsmqDistributor from a different physical location and with different service name.

Thanks for the guidance.