How can I trace the HttpClient request using fiddler or any other tool?

If you are connecting with a url like http://localhost:1234 change it to http://localhost.fiddler:1234/ and the requests from HttpClient should then become visible in Fiddler.


IIS does not use the proxy setting in Internet Option because it runs under a different user identity (default is ApplicationPoolIdentity). @EricLaw has provided a good pointer regarding the problem of capturing traffic of IIS/ASP.NET.

Instead of configuring IIS to use my login account, I edit web.config to force HTTPClient to use proxy, like following.

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

Here is the detail of usage from MSDN.


Generally speaking, simply starting Fiddler before your application is sufficient. You haven't explained what you've tried so far.

  • If it doesn't just work, read: http://fiddlerbook.com/fiddler/help/hookup.asp#Q-DOTNET
  • If your target URL is localhost or 127.0.0.1, read: http://fiddlerbook.com/fiddler/help/hookup.asp#Q-LocalTraffic
  • If your code is running in IIS or ASP.NET, read: http://fiddlerbook.com/fiddler/help/hookup.asp#Q-IIS