如何在OpenIdConnectConfigurationRetriever.GetAsync通话中使用企业代理?
How to use corporate proxy in the OpenIdConnectConfigurationRetriever.GetAsync call?
我对 Microsoft 和 Azure 的一切都很陌生,甚至不确定我是否为问题选择了正确的标签。
在 Azure 服务源代码(我从同事那里继承的)中,以下代码因 "Host not found" 而失败,因为请求没有通过公司 Web 代理(当我 运行 code at home network, 则调用成功):
OpenIdConnectConfiguration openidConfiguration =
OpenIdConnectConfigurationRetriever.GetAsync(metadataEndpoint, CancellationToken.None).Result;
如果我通过调用创建 WebProxy 对象:
WebProxy proxy = new WebProxy("10.xxx.xxx.xxx", 8080);
那我怎么把它传给OpenIdConnectConfigurationRetriever?
我是否应该改用另一种 .GetAsync
方法?
public static Task<OpenIdConnectConfiguration>
GetAsync(string address, HttpClient httpClient, CancellationToken cancel);
或者我应该使用 BackchannelHttpHandler
(不确定它是什么,在我的搜索过程中出现)
通过以下方式解决:
WebRequest.DefaultWebProxy = new WebProxy("http://10.xxx.xxx.xxx:8080", true);
我对 Microsoft 和 Azure 的一切都很陌生,甚至不确定我是否为问题选择了正确的标签。
在 Azure 服务源代码(我从同事那里继承的)中,以下代码因 "Host not found" 而失败,因为请求没有通过公司 Web 代理(当我 运行 code at home network, 则调用成功):
OpenIdConnectConfiguration openidConfiguration =
OpenIdConnectConfigurationRetriever.GetAsync(metadataEndpoint, CancellationToken.None).Result;
如果我通过调用创建 WebProxy 对象:
WebProxy proxy = new WebProxy("10.xxx.xxx.xxx", 8080);
那我怎么把它传给OpenIdConnectConfigurationRetriever?
我是否应该改用另一种 .GetAsync
方法?
public static Task<OpenIdConnectConfiguration>
GetAsync(string address, HttpClient httpClient, CancellationToken cancel);
或者我应该使用 BackchannelHttpHandler
(不确定它是什么,在我的搜索过程中出现)
通过以下方式解决:
WebRequest.DefaultWebProxy = new WebProxy("http://10.xxx.xxx.xxx:8080", true);