Fiddler does not see API calls from C # HttpClient ()

I have an ASP.NET MVC website that calls a web API web service.

The calls work and return 200 OK - both web service calls on my local computer AND on the web server.

I have Fiddler, but it does not see these calls - only calls to the MVC website (which, in turn, calls the web service).

How can I see the actual calls to web services?

Should this work correctly? Especially for a web service on the Internet.

I stopped referring to http://localhost, and instead I use MACHINENAME - as recommended in some SO posts. But that does not help.

I use HttpClient to call it:

using (var client = new HttpClient())
{
    var byteArray = Encoding.ASCII.GetBytes(username + ":" + password);
    client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));

    client.BaseAddress = new Uri("http://MACHINENAME");
    client.DefaultRequestHeaders.Accept.Clear();
    client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

    var response = await client.PutAsJsonAsync("api/path", custImp);
}

How to view web service calls in Fiddler?

+7
1

Fiddler, Windows, -, , Fiddler.

- IIS . - Fiddler, Fiddler - web.config MVC, , ( , Fiddler):

<configuration>
...
<system.net>
  <defaultProxy>
    <proxy  proxyaddress="http://127.0.0.1:8888" />      
  </defaultProxy>
</system.net>
...
</configuration>

:


BornToCode, .

+9

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


All Articles