Logging Application Block and Remoting

I was helping a colleague today with an interesting problem involving the use of the Logging Application Block and .NET Remoting.  If you have tried this you may see an exception called "System.Reflection.TargetInvocationException" with an inner exception of "Specified cast is invalid". The quick work around is to open upthe configuration console and disable Tracing on the server that is hosting the remoting object. In the Logging AB, there is a call to "System.Diagnostics.Trace.CorrelationManager. LogicalOperationStack". I been told this makes a call to the CallContext beyond that I am not 100% sure what happens. Chances are though it is writing something to the CallContext that does not serialize well.

So in short, disable Tracing for the Logging AB on the server hosting the remoting object to get it to work.

 

If anyone has any comments or ideas on this please, by all means share.