Udostępnij za pośrednictwem


Turning on trace for WCF

First you need to download some windows sdk tools. You can get those from https://www.microsoft.com/downloads/details.aspx?FamilyId=C2B1E300-F358-4523-B479-F53D234CDCCF&displaylang=en. Only check the tools section to save you some time.

The tools that we need is called service trace viewer.

Open the configuration file on your client or server side, include the following section to your config:

 <?xml version="1.0" encoding="utf-8" ?>

<configuration>

 

  <system.serviceModel>

    <diagnostics>

      <messageLogging maxMessagesToLog="30000"

              logEntireMessage="true"

              logMessagesAtServiceLevel="true"

              logMalformedMessages="true"

              logMessagesAtTransportLevel="true">

      </messageLogging>

    </diagnostics>

  </system.serviceModel>

  <system.diagnostics>

    <sources>

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

        <listeners>

          <add name="xml" />

        </listeners>

      </source>

      <source name="System.ServiceModel.MessageLogging" switchValue="Verbose">

        <listeners>

          <add name="xml" />

        </listeners>

      </source>

    </sources>

    <sharedListeners>

      <add name="xml" type="System.Diagnostics.XmlWriterTraceListener" initializeData="e2eTraceTest.e2e" />

    </sharedListeners>

    <trace autoflush="true" />

  </system.diagnostics>

 

</configuration>

Then you will All Programs->Microsoft Windows SDK->Tools->Service Trace Viewer, and then open up the e2eTraceTest.e2e from your client or server running directory.

Hope it helps!

Comments