Errors logged in a tracking or tracing record can be used to find code defects or incorrectly formed messages. The ActivityId property of the Correlation node in the event’s message header can be used to determine the faulting activity. To enable message flow tracing by activity ID, see the Configuring Message Flow Tracing topic in the MSDN library. This topic demonstrates how to enable message flow tracing in the project created in the Getting Started tutorial.
Open Event Viewer by clicking Start, Run, and entering eventvwr.exe.
If you haven’t enabled analytic tracing, expand Applications and Services Logs, Microsoft, Windows, Application Server-Applications. Select View, Show Analytic and Debug Logs. Right-click Analytic and select Enable Log. Leave Event Viewer open so that traces can be viewed.
Open the sample created in the Getting Started Tutorial in Visual Studio 2010. Note that you must run Visual Studio 2010 as an administrator so that the service can be created. If you have the WCF samples installed, you can open the Getting Started Sample, which contains the completed project created in the tutorial.
Right-click the Service project and select Add, New Item. Select Application Configuration File and click OK.
Add the following code to the App.Config file created in the previous step.
<system.serviceModel> <diagnostics> <endToEndTracing propagateActivity="true" messageFlowTracing="true"/> </diagnostics> </system.serviceModel>
Execute the server application without debugging by pressing CTRL+F5. Execute the client project by right-clicking the Client project and selecting Debug, Start New Instance.
To trace the events from the client to the server, add the following to the application configuration file in the Client project.
In Program.cs in the client, add the following Using statement.
In the Main method in the program.cs file in the client project, set the Trace GUID to be propagated in the event log.
Refresh and examine the Analytic log. Look for an event with Event ID 220. Select the event, and click the Details tab in the preview pane. This event will contain the correlation ID for the calling activity.
In some cases, the ActivityID can change from the original GUID to a new ActivityID. In that case, a transfer event is emitted. This event ID is 499, and the event will contain the following data in the header.