How can I make Fiddler capture HTTP requests made by my MVC application to my ASP.NET web API?

I have an ASP.NET MVC application that makes a request to the ASP.NET web API using the System.Net.HttpClient class. As an MVC application, i.e. The client and the ASP.NET web API, that is, the server, are hosted in Visual Studio by the IIS Express debugger when I start debugging them.

I would like Fiddler to capture the requests that were made by my MVC application in the ASP.NET web API. Is it possible?

+6
source share
2 answers

Fiddler Docs adds this exact issue.

There are two parts to this.

1 Install the MVC application to use fiddler as a proxy server or in the web.config file

 <configuration> <system.net> <defaultProxy> <proxy bypassonlocal="false" usesystemdefault="true" /> </defaultProxy> </system.net> </configuration> 

Or in the code: GlobalProxySelection.Select = new WebProxy("127.0.0.1", 8888);

2 Link to api by machine name instead of localhost. This is due to the fact that .net will not use a proxy by default when accessing something through localhost.

+4
source

The .NET Framework is hard-coded to not transmit traffic to localhost through a proxy. Try using http://localhost.fiddler:xxxx/ . This should direct your request through a violinist so that it can capture traffic. See the Fiddler documentation for this issue and a few other address options for more details.

+2
source

Source: https://habr.com/ru/post/972110/


All Articles