简体   繁体   中英

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.

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.

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.

Starting Fiddler first and/or as admin won't work. Starting my app or VS as admin won't work either.

Editing machine.config won't work, there isn't even .net section (in win10 probably), I modified the .web one.

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). There are several ways you can configure your .NET apps to go through one. Fiddler documentation specifies it.

But basically:

  1. Specify a proxy in your exe config:

     <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 . In this case, use ip4.fiddler as a host instead of localhost (or ipv6.fiddle for IPv6)

If traffic is encrypted, in Fiddler, go to :

Tools- Options - HTTPS - Decrypt HTTPS Traffic. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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