Tuesday, March 6, 2012

How to Trace WCF Exception

To trace a WCF Exception add the following code in the Web.config file under the configuration Tag
<system.diagnostics>
<sources>
<source name="System.ServiceModel" switchValue="Warning">
<listeners>
<add name="WcfLogSample" />
</listeners>
</source>
</sources>
<sharedListeners>
<add name="WcfLogSample" type="System.Diagnostics.XmlWriterTraceListener"
initializeData="D:\TracingFile.svclog" traceOutputOptions="Callstack" />
</sharedListeners>
<trace autoflush="true" />
</system.diagnostics>

This code will make trace file at the address in bold. open that file it will contain any exception occurred in your application

No comments:

Post a Comment