让Fiddler调试localhost和127.0.0.1

很久没有用fiddler了(确确说应该是很久没有研究Web开发了),忽然发现fiddler竟然没有捕捉到localhost的请求,一 google

原来:

http://www.fiddlertool.com/Fiddler/help/hookup.asp#Q-LocalTraffic

Why don't I see IE7 or System.NET traffic sent to http://localhost or http://127.0.0.1?

IE7 and the .NET Framework are hardcoded not to send requests for Localhost through any proxies, and as a proxy, Fiddler cannot intercept such traffic.

The workaround is to use your machine name as the hostname instead of Localhost or 127.0.0.1. So, for instance, rather than hitting http://localhost:8081/mytestpage.aspx, instead visit http://machinename:8081/mytestpage.aspx.  Alternatively, you can use http://localhost.:8081/mytestpage.aspx (note the trailing dot after localhost).

...Or, you could Customize your Rules file like so:

(oSession.HostnameIs("MYAPP")) { oSession.host = "127.0.0.1:8081"; }
}

static function OnBeforeRequest(oSession:Fiddler.Session){
  if

...and then just hit http://myapp, which will act as an alias for 127.0.0.1:8081.

IE7 以及 System.Net 对localhost/127.0.0.1的请求不会通过任何代理发送,fiddler也就无法截获。

解决方案

  1. http://localhost.  (locahost紧跟一个点号)
  2. http://127.0.0.1.  (127.0.0.1紧跟一个点号)
  3. http://machinename (机器名)
  4. 手动自定义请求规则
原文地址:https://www.cnblogs.com/smwikipedia/p/1571823.html