Enabling Tracing in ASP.NET Web Services

Enabling Tracing in ASP.NET Web Services

This topic is specific to a legacy technology. XML Web services and XML Web service clients should now be created using Windows Communication Foundation .

This topic describes how to enable tracing in Web services built with ASP.NET in .NET Framework version 3.5. Enable tracing to identify how to increase performance and stability as well as increasing the ability to troubleshoot Web service issues.

Tracing for ASMX

To enable tracing for ASMX, use the following sample configuration.

Bb885203.note(en-us,VS.100).gifNote:
Tracing is only enabled when the application is fully trusted.

<system.diagnostics>
    <trace autoflush="true" />
    <sources>
        <source name="System.Web.Services.Asmx">
            <listeners>
                <add name="AsmxTraceFile" type="System.Diagnostics.TextWriterTraceListener" initializeData="local.log" traceOutputOptions="LogicalOperationStack, DateTime, Timestamp, ProcessId, ThreadId" />
            </listeners>
        </source>
    </sources>
    <switches>
        <add name="System.Web.Services.Asmx" value="Verbose"  />
    </switches>
</system.diagnostics>

Trace Level

All traces (except exceptions and serializations errors) use Information level. The exception traces uses Warning level for exceptions that are handled, and Error level for others. If the Trace level is Verbose, the exception stack is also traced, otherwise, only the exception type, the message and the code method where it was caught are traced. For serialization and deserialization errors, if tracing is enabled, serialization events are used to track the unknown elements and attributes in the SOAP message.

Trace Points

On the client side, the trace points are the followings,

  • Before and after Request Serialization

  • Before and after GetWebResponse

  • Before and after Response Deserialization

  • Before and after XmlSerializer Creation

On the server side, the trace points are the followings,

  • When the IIS Handler is called

  • Before and after Request Deserialization

  • Before Dispatching

  • When the server method returns

  • Before and after Serialization of response

  • Before and after XmlSerializer Creation

Community Additions

ADD
Show:
© 2016 Microsoft