Tracking/Diagnos WCF Service

This blog explains how to track your WCF Service activity.

Hi some time we are getting error in service, when hosted or while testing service with Visual Studio. To solve error we are usually taking help of directly Google search engine or other community sites like C- Sharp corner.

OR

To some times want track our WCF Activity while developing or testing, How to do this. Below is the config setting of web.config file that help tracing our WCF service's activity.
  1. <?xml version="1.0"?>  
  2. <configuration>  
  3. <system.diagnostics>  
  4.     <trace autoflush="true" />  
  5.     <sources>  
  6.       <source name="System.ServiceModel" switchValue="Information,ActivityTracing">  
  7.         <listeners>  
  8.           <add name="xml"></add>  
  9.         </listeners>  
  10.       </source>  
  11.   
  12.       <source name="System.ServiceModel.MessageLogging">  
  13.         <listeners>  
  14.           <add name="xml"></add>  
  15.         </listeners>  
  16.       </source>  
  17.     </sources>  
  18.   
  19.     <sharedListeners>  
  20.       <add name="xml" type="System.Diagnostics.XmlWriterTraceListener" initializeData="D:\WCFDiagnosticsAndroid.svclog"></add>  
  21.     </sharedListeners>  
  22.   </system.diagnostics>  
  23.   </configuration>