Enable WCF Service Tracing

Most of the time we are getting and error from WCF and we are not able get the actual error. so for actual error enable the service trace for this we need to perform couple of steps.

  1. Open the service Web.Config file.
  2. Add the system.diagnostics in the web.config file
     

    <system.diagnostics>

      <!-- This logging is great when WCF does not work. -->

      <sources>

        <source name="System.ServiceModel" switchValue="Information, ActivityTracing" propagateActivity="true">

          <listeners>

            <add name="traceListener" type="System.Diagnostics.XmlWriterTraceListener" initializeData= "C:\ Service\traces1.svclog" />

          </listeners>

        </source>

      </sources>

    </system.diagnostics> 
     

  3. Change the path where you want the trace log.
  4. Run the service and check the trace log.
  5. To open the trace file download the tool "SvcTraceViewer.exe"
Next Recommended Reading WCF And WCF Service Components