Correlating messages with WF and WCF

Topics: Logging Application Block
Dec 28, 2006 at 8:23 PM
I am trying to use the logging block in an SOA environment with a rich client that uses WCF services which use WF. I am trying to use the Tracer class which takes advantage of the CorrelationManager. It turns out the WCF and WF also use the CorrelationManager and change the ActivityID within their code. When code returns from execution it restores the old ActivityID. WCF uses the TraceTransfer of the TraceSource to correlate the entries from one ActivityID to another. This can be seen by analyzing the trace outputs from WCF.

So this leaves me trying to find a way to correlate messages from my client through the WCF channel to the service and through WF in the service. My first attempt was to use a Using statement with the Tracer class within the entry point of the client and pass it to the service in a message header. Then on the service implement a Tracer in each operation passing in the guid from the message header.

This gets me around the WCF issue since I am passing my own Id, but when I am logging entries inside of workflow activities, the ActivityID is no longer the one I passed to the Tracer class. It is the workflow instance id. Once execution returns from workflow, my id is back in the ActivityID. It seems there is no way to catch any sort of TraceTransfer entry to see the IDs switch and switch back as WCF and straight .Net tracing allows.

This all makes sense to me, but leaves me without a good solution on how to correlate my messages on the server side when using workflow. I am assuming people will run into this a lot.

Does anyone have any ideas? Any help will be greatly appreciated.

Dec 31, 2006 at 8:38 AM
Great feedback!

I logged this in the teams bugrepository to make sure we have a look at this next time we go over the bugs.