Pages

Wednesday, July 13, 2011

WCF Tracing

To troubleshoot crazy WCF-related errors, a very good option is to trace all the events in the service. While the documentation on MSDN contains useful info, the changes required to actually enable tracing are not all listed there. 

The full settings, that are added to Web.config when enabling tracing through the WCF Configuration Editor, look like this:

 

Web.config
  <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:\Projects\MyProject\App_tracelog.svclog"
type="System.Diagnostics.XmlWriterTraceListener, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
name="ServiceModelTraceListener" traceOutputOptions="Timestamp">
<filter type="" />
</add>
</sharedListeners>
</system.diagnostics>

No comments: