Reputation: 1340
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?
Upvotes: 17
Views: 10606
Reputation: 1163
Small addition. In case of using HttpClientFactory with DI the proxy can be set this way
services.AddHttpClient<ISomeService, SomeService>()
.ConfigurePrimaryHttpMessageHandler(() => new HttpClientHandler()
{
Proxy = new WebProxy(new Uri("http://localhost:8888")),
UseProxy = true
});
Upvotes: 5
Reputation: 20852
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.
Upvotes: 16
Reputation: 33098
In .NET Core 2.1 the default provider was changed from WinHttpHandler to the new SocketsHttpHandler, built entirely on the .NET networking stack.
https://github.com/dotnet/corefx/issues/28603 indicates that Fiddler is expected to work, so verify that you have the latest update for 2.1 and, if things continue not to work, report an issue to corefx on github.
Upvotes: 7