Debugging layered http calls with fiddler

You may reach a point where all you want to know is EXACTLY what is a web server returning to you over http whether it’s from a webservice or even just regular http call. At times this can become very tricky to get access to the raw responses when your requests go through a webservice client like WCF or a http client like EasyHttp.

Yesterday this cropped up that I wanted to get access to the raw response of a web application that I consume from another web application over EasyHttp.

The simplest way to make sure a request goes to the fiddler proxy is replace localhost with ipv4.fiddler (or ipv6.fiddler if that’s what you’re interested in). However there are many scenarios where this won’t work, especially in .NET tools that this results in

The remote name could not be resolved: ‘ipv4.fiddler’

The way I was able to accomplish this:

Instead of having app1 call localhost/restful to change the url to be machineName/restful.

In addition to this change you want to add this section to your web.config while debugging

<system.net>
<defaultProxy>
<proxy usesystemdefault="False" bypassonlocal="False" proxyaddress="http://127.0.0.1:8888 " />
</defaultProxy>
</system.net>

Between these 2 changes this should force the traffic to go across Fiddler’s proxy to be able to be properly captured.

BloggingContext.ApplicationInstance.CompleteRequest();

Advertisements