2

Does anyone know of a way to set a proxy on httpclient that comes with the wcf web api? I just want to be able to monitor all the traffic with fiddler.

coding4fun
  • 8,038
  • 13
  • 58
  • 85

1 Answers1

2

You don't need to set a proxy on HttpClient to use fiddler. If you are hosting on localhost then check these tips here http://www.fiddler2.com/fiddler/help/hookup.asp#Q-LocalTraffic.

if you really want to use a proxy then you can do it like this,

var clientHandler = new HttpClientHandler();
clientHandler.Proxy = new WebProxy(new Uri("http://..."));
var httpClient = new HttpClient(clientHandler);
Darrel Miller
  • 139,164
  • 32
  • 194
  • 243