DCSIMG
Fiddling with Fiddler 2 on localhost - David Sackstein's Blog

Fiddling with Fiddler 2 on localhost

Fiddler 2 is a great tool to monitor the http activity on a computer, and an excellent debugging and teaching tool for WCF and ASMX.

It’s free and you can download the latest version from here.

What I like about it most, is that it can display SOAP messages - request and response as a DOM. You can really see what those contract attributes are doing : )

For my very simple Calculator.Add operation it displayed the following:

Fiddler 2

Nice, no?

The problem is, that it works best when monitoring traffic between your computer and another IP address. When the server and client are both on your laptop – as they are in my demos – you need to tweak it a bit to get it to work.

There are a number of tweaks on the net, but not all of them work in every case.

Here is a quick summary of the ones I tried. For all tweaks, leave the server as is and modify the address that the client uses in it’s end point.

  1. Replace “localhost” with “localhost.”  (yes, add a dot).
    This one worked on my XP machine, but Vista throws an exception.
  2. Replace “localhost” with “127.0.0.1.”
    Vista throws an exception.

These two worked for me with Vista Business, IIS 7.0 and with a WCF client and server (Visual Studio 2008).

  1. Replace “localhost” with “<name of your machine>”.
  2. Replace “localhost” with “ipv4.fiddler”.

For a WCF client use the following code (change “ipv4.fiddler” to test the other options).

    CalculatorServiceClient proxy = new CalculatorServiceClient();

 

    string uriAsString = proxy.Endpoint.Address.Uri.ToString();

    string newUriString = uriAsString.Replace("localhost", "ipv4.fiddler");

 

    proxy.Endpoint.Address = new EndpointAddress(newUriString);

 

    result = proxy.Add(20, 11);

By the way, this works for ASMX Web Service clients too. Like so:

    Service service = new Service();

    service.Url = service.Url.Replace("localhost", "localhost.");

 

    // Use service

This worked for me on XP - I didnt try it on Vista. I assume that here also, the dot would throw an exception but that I could use the machine name successfully.

When using WSE with ASMX, you need to make an additional change - due to the SOAP headers associated with WS Addressing:

    ServiceWse service = new ServiceWse();

 

    string address = service.Url;

    string addressVia = service.Url.Replace("localhost", "localhost.");

 

    service.Destination = new EndpointReference

    (

        new Uri(address),

        new Uri(addressVia)

    );

Its a bit of a twiddle – but it’s worth checking which option works for you.

It’ll really open up the world of SOAP!

Published Wednesday, May 27, 2009 3:55 PM by David Sackstein

Comments

# re: Fiddling with Fiddler 2 on localhost

Friday, December 04, 2009 4:57 PM by Lasse Sjørup

I use fiddlers urlreplace to redirect calls to my live server to my localhost.  I lacked a few things so I’ve created the “fiddler bulk urlreplace” plugin fiddlerurlreplace.codeplex.com. This will allow you to browse your localhost as if it was your live server transparent to the browser, it will allow you to access cookies normally only visible on the server and it supports replacing only subparts of the site. So debugging webservices called from my live servers or from flash becomes rather easy. 

Leave a Comment

(required) 
(required) 
(optional)
(required) 

Enter the numbers above:
Powered by Community Server (Commercial Edition), by Telligent Systems