[HOWTO] Capture outgoing HTTP requests of .NET 6 Web API using Fiddler Classic

Lately I faced the following challenge. I wanted to analyze the requests sent by a .NET Web API application to the underlying Cosmos DB to get insights about the RU consumption (RU = request units, for more details see here) of the different Cosmos DB operations. Whenever you call Cosmos DB via HTTP API – what I basically do but the HTTP calls are performed by library Microsoft.EntityFrameworkCore.Cosmos and I couldn’t find a way to intercept them – the Cosmos DB service returns a header called x-ms-request-charge in the response which indicates the costs of the performed operation.

Telerik Fiddler Classic to the rescue I thought… but first it didn’t work and I couldn’t make it work until I changed the launch profile of the .NET Web API in Visual Studio to IIS Express and set up a proxy according to the docs.

Briefly summarized, I had to perform the following steps:

  1. Change launch profile of .NET Web API in Visual Studio to IIS Express
  2. Enable Decrypt HTTPS traffic setting in Fiddler (Tools > Options)
  3. Set up proxy (see here)
    Important: start cmd as administrator to successfully set up the proxy
Set launch profile to IIS Express
Enable Decrypt HTTPS traffic in Fiddler options

After that I could finally intercept the requests of my .NET Web API to the underlying Cosmos DB and I got some valuable insights I couldn’t get from the Cosmos DB account insights in the azure portal.

Captured request in Telerik Fiddler Classic

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Website Powered by WordPress.com.

Up ↑

%d bloggers like this: