Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

How to: Enable Tracing

Windows Identity Foundation
[Starting with the .NET Framework 4.5, Windows Identity Foundation (WIF) has been fully integrated into the .NET Framework. The version of WIF addressed by this topic, WIF 3.5, is deprecated and should only be used when developing against the .NET Framework 3.5 SP1 or the .NET Framework 4. For more information about WIF in the .NET Framework 4.5, also known as WIF 4.5, see the Windows Identity Foundation documentation in the .NET Framework 4.5 Development Guide.]

The following configuration shows how to enable WCF tracing. Specifically, it shows how to:

  • Log messages at both the service and transport level, to inspect the raw XML on the wire.

  • Enable WCF exception tracing, to capture errors in message security header processing.

  • Turn on digest logging, which allows inspection of canonicalized digests to help understand signature verification exceptions.

  • Enable activity tracing, to help correlate messages and identify at what stage an exception is thrown.

For more information, see WIF Tracing.

      <messageLogging maxMessagesToLog="30000"
      <!-- This section turns on digest logging, note that for this to work correctly,
           you need to add the following to machine.config:
                <machineSettings enableLoggingKnownPii="true" />
           Search for 'DigestTrace' in the trace viewer to view the digest logs.
      <source name="System.IdentityModel" switchValue="Verbose" logKnownPii="true">
          <add name="xml" />
      <!-- Log all messages in the 'Messages' tab of SvcTraceViewer. -->
      <source name="System.ServiceModel.MessageLogging">
          <add name="xml" />
      <!-- ActivityTracing and propogateActivity are used to flesh out the 'Activities' tab in
           SvcTraceViewer to aid debugging. -->
      <source name="System.ServiceModel" switchValue="Error, ActivityTracing" propagateActivity="true">
          <add name="xml" />
      <!-- This records Microsoft.IdentityModel generated traces, including exceptions thrown
           from the framework. -->
      <source name="Microsoft.IdentityModel" switchValue="Warning">
          <add name="xml" />
      <add name="xml" type="System.Diagnostics.XmlWriterTraceListener" initializeData="trace.e2e" />
    <trace autoflush="true" />

© 2015 Microsoft