Using a proxy with .NET 4.5 HttpClient

前端 未结 3 1507
无人及你
无人及你 2020-12-08 06:11

I\'m troubleshooting a bug with a service I call through .NET\'s HttpClient, trying to route the request through a local proxy (Fiddler), but my proxy settings seem to not b

3条回答
  •  被撕碎了的回忆
    2020-12-08 06:53

    This code worked for me:

    var httpClientHandler = new HttpClientHandler
                            {
                                Proxy = new WebProxy("http://localhost:8888", false),
                                UseProxy = true
                            }
    

    Note that I am not supplying an empty array to my WebProxy constructor. Perhaps that's the problem?

提交回复
热议问题