Forum Discussion
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
1 Reply
- LanHuangFormer Employee
Hi Sivudu007,
Thanks for posting your issue here.
However this platform is used for how-to discussions and sharing best practices for building any app with .NET.Since your issue is a technical question, welcome to post it in Microsoft Q&A forum, the support team and communities on Microsoft Q&A will help you for any technical questions.
Besides, it will be appreciated if you can share it here once you post this technical question Microsoft Q&A.
Best Regards,
Lan Huang