39

I am using IIS7 Express while developing my web application. I need to use fiddler to investigate an issue and cannot figure out how to configure things so I can get the HTTP stream. It seems that IIS7 express will only listen on localhost which means I cannot access the stream.

4 Answers 4

56

This has nothing to do with IIS7 Express and everything to do with the fact that you're using loopback traffic.

Ref: https://www.fiddlerbook.com/fiddler/help/hookup.asp#Q-LocalTraffic

Click Rules > Customize Rules.

Update your Rules file like so:

static function OnBeforeRequest(oSession:Fiddler.Session)
{
    if (oSession.HostnameIs("MYAPP")) { oSession.host = "localhost:portnumber"; }
}

Then, just visit http://myapp in your browser.

Or use the address http://localhost.fiddler/ and Fiddler will use the hostname localhost instead of converting to an IP address.

9
  • I read that and it doesn't work. I assume this is because IIS7 Express only listens on localhost
    – Brettski
    Commented Jan 16, 2011 at 18:08
  • 4
    Hi Eric and Brettski, Brettski is correct, I have actually found the same issue with IIS Express. It seems to only monitor the hostname "localhost" not traffic to 127.0.0.1. I have had a similar issue that I posted about on StackOverflow recently stackoverflow.com/questions/4709014/… Commented Jan 17, 2011 at 0:20
  • 1
    Apparently it has to be running under Admin Rights and you have to go in and modify the bindings. I don't understand why any of this is necessary since Cassini easily does this. Why can't IIS Express just monitor the port on 127.0.0.1 without a "localhost" host header. Commented Jan 17, 2011 at 0:55
  • 1
    Sigh. I wish they'd make up their minds. You can easily use the FiddlerScript on that page: OnBeforeRequest. Edited answer.
    – EricLaw
    Commented Jan 17, 2011 at 18:00
  • Eric, me too. There is no reason to have this type of binding in IIS in my oppinion. "*:1234:localhost" Because it means it is listening on all IP addresses for a host header that comes through as "localhost". I am hoping since you are a softy that you can bring this to the attention of the right people because the binding should actually be "127.0.0.1:1234:" so that any host header pointing to the localhost can be used. Commented Jan 17, 2011 at 19:31
12

One useful variation of Eric's answer (that was edited by Brett) would be to use oSession.port to build the oSession.host. With this little change, if one needs to capture IIS express traffic on http://localhost:12345, they could use http://iisexpress:12345. That will make it easier to capture traffic for sites with random ports as created by WebMatrix and VS. I tried it out with IE and Firefox and capturing IIS Express traffic was a breeze. Fiddler rocks!.

static function OnBeforeRequest(oSession:Fiddler.Session)
{
   //...
   // workaround the iisexpress limitation
   // URL http://iisexpress:port can be used for capturing IIS Express traffic
   if (oSession.HostnameIs("iisexpress")) { oSession.host = "localhost:"+oSession.port; }
   //...
}
1
  • You might also want to add this: oSession.utilReplaceInResponse("localhost:" + oSession.port, "iisexpress:" + oSession.port);
    – Gebb
    Commented Jul 25, 2013 at 9:31
5

With the latest version of fiddler, you only need to navigate to localhost.fiddler:port. However, doing that alone didn't help me and I was still getting access denied when using Windows Authentication. To fix this, I found this blog entry: http://www.parago.de/2013/01/fiddler-and-the-401-unauthorized-error-with-asp-net-web-api-using-integrated-windows-authentication-wia/

In short, create this key:

Key Path HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\ Control\Lsa\MSV1_0

Value Name BackConnectionHostNames

Value Type REG_MULTI_SZ

String Value localhost.fiddler

0

You can use fiddler as a proxy between your clients and the server. This means you start up fiddler, and then access the server using fiddler's port rather then the usual port (default for fiddler2 is 8888 I think). If you need to debug the server "live" vs. real world clients, you can change the IIS binding from :80 to something else, and place fiddler's proxy on port 80.

EDIT: By the way, by default fiddler2 changes the proxy settings on your browsers so that they access everything through fiddler anyway (on the machine in which fiddler is installed only)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.