How to enable WCF tracing

- J.D. Meier, Carlos Farre, Jason Taylor, Prashant Bansode, Steve Gregersen, Madhu Sundararajan, Rob Boucher

Use WCF tracing to help debug your WCF service by logging all operations on your service.

Use following steps to enable Tracing
  1. Open the web.config file of the WCF service using the Configuration editor tool (SvcConfigEditor.exe).
  2. In the Configuration editor, navigate to the Diagnostics node, and click the Enable Tracing link.
  3. This enables Tracing your WCF service and it also creates a listener (ServiceModelTraceListener) and a source (System.ServiceModel) under the Listeners and Sources folder respectively.

To determine where the traces will be written select ServiceModelTraceListener under the Listeners node and note the value of the InitData attribute. The default location where trace messages are written is c:\inetpub\wwwroot\auditingwcf\web_tracelog.svclog.
The configuration file should look as follows:
    <system.diagnostics>
        <sources>
            <source name="System.ServiceModel" switchValue="Warning, ActivityTracing"
                propagateActivity="true">
                <listeners>
                    <add type="System.Diagnostics.DefaultTraceListener" name="Default">
                        <filter type="" />
                    </add>
                    <add name="ServiceModelTraceListener">
                        <filter type="" />
                    </add>
                </listeners>
            </source>
        </sources>
        <sharedListeners>
            <add *initializeData="c:\inetpub\wwwroot\auditingwcf\web_tracelog.svclog"*
                type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
                name="ServiceModelTraceListener" traceOutputOptions="Timestamp">
                <filter type="" />
            </add>
        </sharedListeners>
    </system.diagnostics>

Additional Resources

Last edited Jun 13, 2008 at 6:28 PM by prashantbansode, version 1

Comments

No comments yet.