Welcome to MSDN Blogs Sign in | Join | Help

Tracing Network Calls

Many common networking problems can be diagnosed by tracing System.Net events. This is often much easier than setting up packet captures or other software, particularly if you're working on a production machine. Since tracing is a part of the framework, it works almost everywhere just by dropping some additional configuration.

Here's an example of a complete configuration file for turning on System.Net tracing.

<configuration>
<system.diagnostics>
<trace autoflush="true" />
<sources>
<source name="System.Net">
<listeners>
<add name="MyTrace"/>
</listeners>
</source>
</sources>
<sharedListeners>
<add name="MyTrace" type="System.Diagnostics.TextWriterTraceListener" initializeData="trace.txt" />
</sharedListeners>
<switches>
<add name="System.Net" value="Verbose" />
</switches>
</system.diagnostics>
</configuration>

You can also make the event source more specific by changing System.Net to one of System.Net.Sockets, System.Net.Cache, or System.Net.HttpListener.

Next time: You Are Here

Published Tuesday, June 10, 2008 5:00 AM by Nicholas Allen
Filed under:

Comments

Tuesday, June 10, 2008 1:21 PM by Nicholas Allen's Indigo Blog

# Forwarding Transactions

I want to receive messages that contain a transaction and forward those messages to another service.

Saturday, June 14, 2008 1:25 PM by Stanislav Dvoychenko

# re: Tracing Network Calls

Thanks for reminding about this. I put some screenshots from the ServiceTraceViewer together to show what is logged by System.Net, System.Net.Sockets and System.Net.Cache. Hopefuly it gives an idea of what source to look for what data.

http://plainoldstan.blogspot.com/2008/06/integrating-tracing-on-network-events.html

http://plainoldstan.blogspot.com/2008/06/reviewing-events-from-systemnetcache.html

New Comments to this post are disabled
 
Page view tracker