7. March 2007 07:51
At some point in the development cycle, the inevitable necessity of debugging your application will arise. For WCF services, special support is available for capturing diagnostic data concerning your service and its exchanging of messages with clients. There is a handy utility that ships with the Windows SDK for Vista and .NET Framework 3.0 for viewing the diagnostic output. It is known as the Service Trace Viewer.
Before you can view the diagnostic output in the viewer, the service must be configured to capture the diagnostic data. This is accomplished by making some entries in your service configuration file. Personally, I prefer to take the easy approach and use the Service Configuration Editor.
Once your service configuration has been loaded into the editor, select the Diagnostics folder. You will find there are a few different types of diagnostics ranging from performance counters to logging. I recommend playing around with all of them to get a feel for what they can do. However, I am going to focus on message logging and tracing over the next couple of blog posts.
Notice there is a link to enable each type of diagnostic. It doesn't get much simpler than that. With a single click, your diagnostic of choice can be turned on or off. When enabling message logging and/or tracing, the configuration editor handles setting up the listener for receiving diagnostics and the source used to store the output. There are quite a few settings available for each one. For example, message logging can be configured to record messages at the transport level (as they appear on the wire) or the service level (prior to packaging for transport). For tracing, it is possible to set options such as the trace level for controlling the amount of information that is captured.
Be sure to take a look at your app.config before and after saving the configuration changes. It should be rather obvious how much xml the editor saves your from writing by hand.
Later this week, I will go over some of the capabilities of the Service Trace Viewer by examining some diagnostic output from a service.
f77862d6-e8fd-4f2a-bbf2-062d06624d46|0|.0
By: Jeff Barnes
Category:
Tags: