Intercepting localhost calls with Fiddler

A while back I wrote a post on Intercepting and creating SOAP messages using Fiddler.

I’ve just had to revisit this post to debug changes in a SOAP implementation which seemed to be causing unexplained failures.

So I started up the servers (running in Java) and configured my .NET client as per the previously mentioned post, but for completeness, let’s show the App.config changes here anyway

<system.net>
   <defaultProxy>
    <proxy bypassonlocal="false" usesystemdefault="true" />
   </defaultProxy>
</system.net>  

I then ran Fiddler v4.5.x.x and then the .NET application. Fiddler showed no traffic.

Fiddler and localhost from a .NET application

Hunting around, I found several possible solutions, for intercepting IE or another browser, changing localhost to localhost. was one suggestion as well as adding the Fiddler proxy in some other way, but as per Problem: Traffic sent to http://localhost or http://127.0.0.1 is not captured, simply changing localhost in your application to the machine’s name worked and now I could intercept localhost messages.