简体   繁体   English

Fiddler 不会从我的 C# 应用程序中捕获流量

[英]Fiddler doesn't capture traffic from my C# app

I've tried using Fiddler on Windows 10 x64 and on Windows 7 Ultimate x86 in Oracle VM as a guest, and on the Win 10 as well, with Fiddler2 and Fiddler4, FiddlerCore and Charles proxy.我曾尝试在 Oracle VM 中的 Windows 10 x64 和 Windows 7 Ultimate x86 上使用 Fiddler 作为访客,也在 Win 10 上使用 Fiddler2 和 Fiddler4、FiddlerCore 和 Charles 代理。

Those (Fiddler2, 4, Core, and Charles proxy) capture all the traffic from my browsers, including even Visual Studio update requests (or some microsoft servers VS talks to), but all of the above mentioned setups fail miserably to capture traffic from my app - ran from debug or released folder, or directly from VS debugger, both in x64 and x86.那些(Fiddler2、4、Core 和 Charles 代理)从我的浏览器捕获所有流量,甚至包括 Visual Studio 更新请求(或一些与 VS 对话的微软服务器),但上述所有设置都无法从我的浏览器中捕获流量。 app - 在 x64 和 x86 中从调试或发布文件夹运行,或直接从 VS 调试器运行。

I use VS 2015, targeting .net 4.5 Also I don't have full admin rights on the host OS (win 10), which might be an issue.我使用 VS 2015,针对 .net 4.5 而且我在主机操作系统(win 10)上没有完整的管理员权限,这可能是一个问题。

Starting Fiddler first and/or as admin won't work.首先和/或以管理员身份启动 Fiddler 将不起作用。 Starting my app or VS as admin won't work either.以管理员身份启动我的应用程序或 VS 也不起作用。

Editing machine.config won't work, there isn't even .net section (in win10 probably), I modified the .web one.编辑 machine.config 不起作用,甚至没有 .net 部分(可能在 win10 中),我修改了 .web 部分。

Is there a library that will log requests and responses on app level instead of OS level?是否有一个库可以在应用程序级别而不是操作系统级别记录请求和响应?

Your requests are not going through the system's proxy (which Fiddler modifies, and that's how it intercepts your traffic). 您的请求不是通过系统的代理(Fiddler修改,以及它截获您的流量的方式)。 There are several ways you can configure your .NET apps to go through one. 您可以通过多种方式配置.NET应用程序。 Fiddler documentation specifies it. Fiddler文档指定了它。

But basically: 但基本上:

  1. Specify a proxy in your exe config: 在exe配置中指定代理:

     <configuration> <system.net> <defaultProxy> <proxy bypassonlocal="false" usesystemdefault="true" /> </defaultProxy> </system.net> </configuration> 
  2. Manually specify it on the requests: 在请求上手动指定它:

    objRequest = (HttpWebRequest)WebRequest.Create(url);
    objRequest.Proxy= new WebProxy("127.0.0.1", 8888);

Also, most .NET classes bypass the proxy if accessing localhost . 此外,如果访问localhost ,大多数.NET类都会绕过代理。 In this case, use ip4.fiddler as a host instead of localhost (or ipv6.fiddle for IPv6) 在这种情况下,使用ip4.fiddler作为主机而不是localhost (或IPv6的ipv6.fiddle

If traffic is encrypted, in Fiddler, go to : 如果流量是加密的,请在Fiddler中,转到:

Tools- Options - HTTPS - Decrypt HTTPS Traffic. 工具 - 选项 - HTTPS - 解密HTTPS流量。 Install the certificate. 安装证书。

Then you should be able to right click on the URL in the list, and then and save the full request and response. 然后,您应该能够右键单击列表中的URL,然后保存完整的请求和响应。

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

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