Using Fiddler with IIS7 Express

懵懂的女人 提交于 2019-11-28 17:12:27
EricLaw

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.

Jaro Dunajsky

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; }
   //...
}

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

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)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!