0

I am very new to all things Microsoft and Azure and am not even sure that I have selected the correct tags for the question.

In the Azure service source code (that I have inherited from a colleague) the following code fails with "Host not found" because the request is not going through the corporate web proxy (when I run the code at home network, then the call succeeds):

OpenIdConnectConfiguration openidConfiguration = 
    OpenIdConnectConfigurationRetriever.GetAsync(metadataEndpoint, CancellationToken.None).Result;

If I create a WebProxy object by calling:

WebProxy proxy = new WebProxy("10.xxx.xxx.xxx", 8080);

then how could I please pass it to the OpenIdConnectConfigurationRetriever?

Should I maybe switch to using another .GetAsync method?

public static Task<OpenIdConnectConfiguration> 
    GetAsync(string address, HttpClient httpClient, CancellationToken cancel);

Or should I maybe use a BackchannelHttpHandler (not sure what it is, comes up during my searches)

Alexander Farber
  • 21,519
  • 75
  • 241
  • 416

1 Answers1

0

Solved that by:

WebRequest.DefaultWebProxy = new WebProxy("http://10.xxx.xxx.xxx:8080", true);
Alexander Farber
  • 21,519
  • 75
  • 241
  • 416
  • From reading just this it is not clear what WebRequest is any how I pass it to OpenIdConnectConfigurationRetriever. Can you please expand the answer with a complete example? Or is this something static that just needs to be called before the GetAsync? – bugybunny Jun 03 '21 at 06:39