C# – Fiddler not capturing traffic from .Net Core

.net corecfiddlerhttps

I have a console app that calls a number of 3rd party services via HTTP/HTTPS that was originally written to run under the .Net Framework. Fiddler works fine with that version of the app, capturing all of the HTTP and HTTPS traffic.

I ported the app to .net Core 2.1 and now Fiddler does not capture any of the HTTP/HTTPS traffic from the app.

Any suggestions as to why Fiddler (v5.0) is not working to capture traffic from the .Net Core app?

Best Answer

In my office environment, Fiddler still does not intercept requests that are issued by .NET Core 2.2 against external resources. I guess this is due to our local proxy setup.

My workaround is to capture requests from .NET Core 2.2 by explicitly defining Fiddler as a proxy to be used by the HttpClient class:

        var httpClient = new HttpClient(
           handler: new HttpClientHandler
           {
               // 8888 = Fiddler standard port
               Proxy = new WebProxy(new Uri("http://localhost:8888")),  
               UseProxy = true
           }
        );

This reliably tunnels all requests coming from Core through Fiddler.