Friday, 18 March 2011

Using the Fiddler Tool Proxy to Debug Visual Studio Web Tests and Load Tests

The Fiddler Tool ( only listens to WinInet traffic by default - so it doesn't normally pick up any traffic which comes from your Visual Studio Web Tests or Load Tests - even when capturing is on. To help debug your Visual Studio tests, you can set the proxy manually within your code so it forces the traffic through the Fiddler proxy:

//For Fiddler Debugger
this.Proxy = "http://localhost:8888";
WebProxy webProxy = (WebProxy)this.WebProxy;
webProxy.BypassProxyOnLocal = false;

Note that you should have the System.Net namespace in your usings/Imports statements for the WebProxy class. This also assumes Fiddler is running and is set up to use the default proxy port of 8888.