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
Comments
Anonymous
June 10, 2008
I want to receive messages that contain a transaction and forward those messages to another service.Anonymous
June 14, 2008
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