Wednesday, November 18, 2015

Assist with debugging .NET application

To assist with debugging any peculiar behavior with code in Visual Studios, use the Microsoft Service Trace Viewer.

1.) Create a trace file - c:\logs\Traces.svclog

2.) Add diagnostics configuration section to the config file
  <system.diagnostics>
    <sources>
      <source name="System.ServiceModel"
              switchValue="Information, ActivityTracing"
              propagateActivity="true">
        <listeners>
          <add name="traceListener"
              type="System.Diagnostics.XmlWriterTraceListener"
              initializeData="c:\logs\Traces.svclog"  />
        </listeners>
      </source>
    </sources>
  </system.diagnostics>

3.) Run the application to produce the behavior and check the log file for assistance.