简体   繁体   English

无法让Fiddler捕获到IIS的本地流量

[英]Can't Get Fiddler to Capture local traffic to IIS

I have recently installed the latest Fiddler (Fiddler4) and absolutely nothing that I try is working to get it to capture local traffic. 我最近安装了最新的Fiddler(Fiddler4),我尝试的任何东西都是为了让它捕获本地流量。 I have an MVC application that is connecting to an MVC WebApi app both running on IIS, here's what I've tried: 我有一个MVC应用程序连接到在IIS上运行的MVC WebApi应用程序,这是我尝试过的:

  • Fiddler Options > Connections > Monitor All Connections & Use PAC Script Fiddler选项>连接>监视所有连接并使用PAC脚本
  • Changed the WebClient C# call to use the following URLs with no success: 更改了WebClient C#调用以使用以下URL但未成功:
  • Changed my "Default Website" in IIS to run under a new AppPool that uses my local account, and ran Fiddler as administrator 在IIS中更改我的“默认网站”以在使用我的本地帐户的新AppPool下运行,并以管理员身份运行Fiddler
  • added <system.net> <defaultProxy> <proxy bypassonlocal="False" usesystemdefault="True" /> </defaultProxy> </system.net> to my web.config of the MVC app. <system.net> <defaultProxy> <proxy bypassonlocal="False" usesystemdefault="True" /> </defaultProxy> </system.net>到我的MVC应用程序的web.config中。

Nothing has worked, I have no idea what to try. 没有什么工作,我不知道该尝试什么。 Any advice is greatly appreciated. 任何意见是极大的赞赏。 Thanks, Shawn 谢谢,肖恩

It turned out that I needed to set up Fiddler as a reverse proxy ( http://fiddler2.com/documentation/Configure-Fiddler/Tasks/UseFiddlerAsReverseProxy ). 事实证明,我需要将Fiddler设置为反向代理( http://fiddler2.com/documentation/Configure-Fiddler/Tasks/UseFiddlerAsReverseProxy )。 I don't really understand why before I upgraded from Fiddler2 to Fiddler4 I didn't have to do this. 我真的不明白为什么在我从Fiddler2升级到Fiddler4之前我没有必要这样做。 I used to be able to just use http://ipv4.localhost/app-name and all worked fine. 我以前只能使用http://ipv4.localhost/app-name ,一切正常。 In order to get it working with Fiddler4, though, I set-up the reverse proxy, and then changed all my requests from http://ipv4.localhost/app-name to http://machinename:8888/app-name . 但是,为了使它与Fiddler4一起工作,我设置了反向代理,然后将我的所有请求从http://ipv4.localhost/app-namehttp://machinename:8888/app-name I can now listen in to inter-app communications. 我现在可以收听应用间通信。 Any idea why I didn't have to do this with Fiddler2, but I now do after upgrading to Fiddler4? 知道我为什么不用Fiddler2做这个,但我现在在升级到Fiddler4之后呢?

I know you mentioned this in your OP, but this worked for me and was super simple to do, so I thought I would share in case others run into the same problem and don't want to go through the trouble of setting up a reverse proxy if they don't need to. 我知道你在你的OP中提到了这一点,但是这对我有用并且非常简单,所以我想我会分享以防其他人遇到同样的问题并且不想经历设置反向的麻烦代理,如果他们不需要。


I got this to work by simply changing the IIS Application Pool whose traffic I wanted to inspect to run under my identity, since Fiddler seems to only capture traffic of the logged in user by default. 我通过简单地更改我想检查的流量在我的身份下运行的IIS应用程序池来实现这一点,因为Fiddler似乎只捕获默认情况下登录用户的流量。 Just make sure your user has all of the necessary permissions required by IIS; 只需确保您的用户具有IIS所需的所有必要权限; I'm an admin so this wasn't an issue for me. 我是管理员,所以这对我来说不是问题。 And of course, don't forget to change the IIS Application Pool identity back when you are done. 当然,完成后不要忘记更改IIS应用程序池标识。

The other option of course is to instead log in as the user that the IIS Application Pool is running as (if it's not a service account like Network Service ) and then run Fiddler while logged in as that other user. 另一种选择当然是以IIS应用程序池运行的用户身份登录(如果它不是像Network Service这样的服务帐户),然后在以其他用户身份登录时运行Fiddler。

The easiest reliable solution I know to capture non-Webbrowser traffic is to explicitly specify Fiddler's port as proxy for web requests. 我知道捕获非Webbrowser流量的最简单可靠的解决方案是明确指定Fiddler的端口作为Web请求的代理。 Depending on requests your code is making code would look similar to: 根据请求,您的代码使代码看起来类似于:

 request.Proxy = new WebProxy("127.0.0.1", 8888)

Note: don't forget to run Fiddler with "Capturing" and "All Process" (visible in status bar of Fiddler) 注意:不要忘记使用“捕获”和“所有进程”运行Fiddler(在Fiddler的状态栏中可见)

Try adding a record in your hosts file (c:\\windows\\system32\\drivers\\etc\\hosts), like: 尝试在主机文件中添加记录(c:\\ windows \\ system32 \\ drivers \\ etc \\ hosts),如:

127.0.0.1   mysite.local

You'll then need a binding in your website in IIS to match. 然后,您需要在IIS中的网站中进行绑定才能匹配。

Then use http://mysite.local/ 然后使用http://mysite.local/

Try using http://machinename./page 尝试使用http://machinename./page

ie.. try suffixing a period to the machine name and browse. ie ..尝试将句点后缀为机器名称并浏览。

I got the same issue. 我遇到了同样的问题。 fixed by modifying Web.config 通过修改Web.config来修复

<system.net>
    <defaultProxy enabled="true">
        <proxy proxyaddress="http://127.0.0.1:8888" bypassonlocal="False"/>
    </defaultProxy>
</system.net>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM