by: Natasha Shakhmatov
First thing first. If you plan to work with WCF do yourself a favor and learn how to use the Service Trace Viewer Tool (SvcTraceViewer.exe).
This is an easy to install, easy to use, easy to configure tool that has the potential of saving you countless hours of frustrating debugging.
Here are the steps:
1. SvsTraceViewer.exe can be found here C:\Program Files\Microsoft SDKs\Windows\vX.X\Bin
If you do not have the C:\Program Files\Microsoft SDKs folder it means that Windows SDK tools are not installed on the machine. You can get the SDK here:
Note that you only need to install the Tools:
2. Configure tracing in the application’s config file. Below are the instructions copied from the MSDN site:
You can configure tracing using the application’s configuration file-either Web.config for Web-hosted applications, or Appname.config for self-hosted applications. The following is an example:
In this example, the name and type of the trace listener is specified. The Listener is named sdt and the standard .NET Framework trace listener (System.Diagnostics.XmlWriterTraceListener) is added as the type. The initializeData attribute is used to set the name of the log file for that Listener to be SdrConfigExample.e2e. For the log file, you can substitute a fully-qualified path for a simple file name.
The example creates a file in the root directory called SdrConfigExample.e2e. When you use the Trace Viewer to open the file as described in the “Opening and Viewing WCF Trace Files” section, you can see all the messages that have been sent.
Note: you can just copy and paste the example above into your config file and it will work fine. I recommend, however changing the file name to have a .svclog extension. This way you can just double-click on the file to start the viewer.
Here is my config: