How to Enable End-to-End Service Tracing in WCF Services?

When you monitor activities in a distributed application, it can be difficult to correlate events on various machines, such as the correct sequence in which activities occurred and which activity caused a subsequent one to occur. WCF provides a solution that has a built-in correlation mechanism, which you can enable by doing the following:

  • Enable activity tracing.

  • Set the propagateActivity to true. This propagates the current activity ID across service boundaries, which enables tools to associate client and service activities that share the same activity ID. 

The following code example shows how you can enable message correlation in a configuration file.

  [Message correlation example]

  <source name="System.ServiceModel"

          switchValue="Information, ActivityTracing"



When you have enabled activity correlation in your client application and service, you can run your solution to generate the log files. You can then open both the client and service log files in the Service Trace Viewer tool and analyze the end-to-end trace information.

For more information about trace correlation, see Activity Tracing and Propagation for End-To-End Trace Correlation.