Enabling Network Tracing in .Net

Enabling Network Tracing in .Net

Added by Nasir Mahmood updated on Friday, November 17, 2017


Many times we want to enable Network tracing in our dot net application to test application's performance. In this tutorial we will learn how to achieve this.

Using Web.config:

Network tracing provides access to information about method invocations and network traffic generated by a managed application. You must complete the following tasks to enable network tracing in your application:

Now add following code to application configuration file.


    <source name="System.Net" tracemode="includehex" maxdatasize="1024">
        <add name="System.Net"/>
    <source name="System.Net.Sockets">
        <add name="System.Net"/>
    <source name="System.Net.Cache">
        <add name="System.Net"/>
    <add name="System.Net" value="Verbose"/>
    <add name="System.Net.Sockets" value="Verbose"/>
    <add name="System.Net.Cache" value="Verbose"/>
    <add name="System.Net" type="System.Diagnostics.TextWriterTraceListener"
					 initializeData="c:\trace.log" />
  <trace autoflush="true"/>

Now after debuging application we can see our trace file at path c:\trace.log.

For more information Configure Network Tracing

Related Tags


32 Tutorials
27 Snippets
6 Products


Contact Us

Contact us

Stay Connected