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.


Tracing is only enabled when the application is fully trusted.

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

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