Troubleshooting interactions when using TFS Client API

The current project I’m on is performing some integration with Team Foundation Server.  The code worked very well from the developer stations, but then we ran into some issues once we deployed the system to a web server.  While we were trying to track down the issues we ran into the scenario where things just looked like a black box to us once we hit the TFS Client API code.  Luckily the TFS team does output trace messages using specific trace switches.  To enable this all you have to do is add the following into your configuration file (web.config or app.config):

<system.diagnostics> 
  <switches> 
    <add name="TeamFoundationSoapProxy" value="4" /> 
    <add name="VersionControl" value="4" /> 
  </switches> 
  <trace autoflush="true" indentsize="2"> 
    <listeners> 
      <add name="myListener" ... />
  </trace> 
</system.diagnostics>

Just add in the trace listeners you want see.  I was using DebugView on the server to watch the interactions live, so I didn’t add a trace listener when I was troubleshooting.  Also, it looks like they created special trace listeners out of the box for TFS as well: TeamFoundationTraceListener, TeamFoundationTextWriterTraceListener and Client.PerfTraceListener.

Hope this helps someone else.  It came in very handy for us to see what messages and headers were being sent across the wire.