web analytics

Using Service Trace Viewer to Diagnose WCF Service

Options
@2021-01-14 12:35:13

Recommended Settings for Debugging

For debugging environment, choose Information or Verbose, along with ActivityTracing for either a user-defined or System.ServiceModel trace source. To enhance debugging, you should also add an additional trace source (System.ServiceModel.MessageLogging) to the configuration to enable message logging. Notice that the switchValue attribute has no impact on this trace source. If you want to disable the trace source, you should use the logMessagesAtServiceLevellogMalformedMessages, and logMessagesAtTransportLevel attributes of the messageLogging element instead.

The following example demonstrates the recommended settings, using a shared listener that utilizes the XmlWriterTraceListener.

<configuration> 
<system.diagnostics> 
  <sources> 
    <source name="System.ServiceModel" 
            switchValue="Information, ActivityTracing" 
            propagateActivity="true" > 
      <listeners> 
        <add name="xml"/> 
      </listeners> 
    </source> 
    <source name="System.ServiceModel.MessageLogging"> 
      <listeners> 
        <add name="xml"/> 
      </listeners> 
    </source> 
    <source name="myUserTraceSource" 
            switchValue="Information, ActivityTracing"> 
      <listeners> 
        <add name="xml"/> 
      </listeners> 
    </source> 
  </sources> 
  <sharedListeners> 
    <add name="xml" 
         type="System.Diagnostics.XmlWriterTraceListener" 
               initializeData="C:\logs\Traces.svclog" /> 
  </sharedListeners> 
</system.diagnostics>  

 <system.serviceModel> 
  <diagnostics wmiProviderEnabled="true"> 
      <messageLogging
           logEntireMessage="true"
           logMalformedMessages="true" 
           logMessagesAtServiceLevel="true"
           logMessagesAtTransportLevel="true" 
           maxMessagesToLog="3000"
       /> 
  </diagnostics> 
</system.serviceModel> 
</configuration> 

@2021-01-18 10:51:41

Recommended Settings for a Production Environment

For a production environment, if you are using WCF trace sources, set the switchValue to Warning. If you are using the WCF System.ServiceModel trace source, set the switchValue attribute to Warning and the propagateActivity attribute to true. If you are using a user-defined trace source, set the switchValue attribute to Warning, ActivityTracing. If you do not anticipate a hit in performance, you can set the switchValue attribute to Information in all the previously mentioned cases, which generates a fairly large amount of trace data. The following example demonstrates these recommended settings.

<configuration> 
<system.diagnostics> 
  <sources> 
    <source name="System.ServiceModel" 
            switchValue="Warning" 
            propagateActivity="true" > 
      <listeners> 
        <add name="xml"/> 
      </listeners> 
    </source> 
    <source name="myUserTraceSource" 
            switchValue="Warning, ActivityTracing"> 
      <listeners> 
        <add name="xml"/> 
      </listeners> 
    </source> 
  </sources> 
  <sharedListeners> 
    <add name="xml" 
         type="System.Diagnostics.XmlWriterTraceListener" 
               initializeData="C:\logs\Traces.svclog" /> 
  </sharedListeners> 
</system.diagnostics>  

<system.serviceModel> 
  <diagnostics wmiProviderEnabled="true"> 
  </diagnostics> 
</system.serviceModel> 
</configuration> 

@2021-01-24 21:30:08

Where can you get the SvcTraceViewer Tool? You can get it by downloading the Windows SDK, depending on the OS version you have, you may find it in different places.

Comments

You must Sign In to comment on this topic.


© 2024 Digcode.com