System.Net network tracing doesn't work in .net app

Siv Siri 21 Reputation points
2022-04-01T13:47:58.23+00:00

System.Net network tracing doesn't work in .net app
This is the only output is see in the log file. I made sure the TRACE is enabled :

System.Net Information: 0 : [23592] Current OS installation type is 'Client'.

ProcessId=25132

DateTime=2022-03-30T17:49:56.1303174Z

System.Net Information: 0 : [17404] Current OS installation type is 'Client'.

ProcessId=264

DateTime=2022-03-30T17:50:37.3832981Z

This is the diagnostics section from my web.config file.

<system.diagnostics>

<sources>

  <source name="System.Net" tracemode="includehex" maxdatasize="1024">

    <listeners>

      <add name="MyTraceFile"/>

    </listeners>

  </source>

  <source name="System.Net.Cache">

    <listeners>

      <add name="MyTraceFile"/>

    </listeners>

  </source>

  <source name="System.Net.Http">

    <listeners>

      <add name="MyTraceFile"/>

    </listeners>

  </source>

  <source name="System.Net.Sockets">

    <listeners>

      <add name="MyTraceFile"/>

    </listeners>

  </source>

  <source name="System.Net.WebSockets">

    <listeners>

      <add name="MyTraceFile"/>

    </listeners>

  </source>

</sources>

<switches>

  <add name="System.Net" value="Verbose"/>

  <add name="System.Net.Cache" value="Verbose"/>

  <add name="System.Net.Http" value="Verbose"/>

  <add name="System.Net.Sockets" value="Verbose"/>

  <add name="System.Net.WebSockets" value="Verbose"/>

</switches>

<sharedListeners>

  <add name="MyTraceFile"

    type="System.Diagnostics.TextWriterTraceListener"

    initializeData="network.log"

    traceOutputOptions="ProcessId, DateTime"

  />

</sharedListeners>

<trace autoflush="true"/>

</system.diagnostics>

Environment - .NET 4.7.2

ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,514 questions
.NET Runtime
.NET Runtime
.NET: Microsoft Technologies based on the .NET software framework.Runtime: An environment required to run apps that aren't compiled to machine language.
1,168 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.