Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4335

Blazor unable to reach login.microsoftonline.com due to network setup

$
0
0

I have a Blazor .NET 8 server-side app working correctly on an unsecured machine, and am trying to move it to a machine that has no direct outbound internet access; only via web proxy. The app uses OpenIdConnect and users should log in using Microsoft Entra ID.

When a user tries to log in, the server console logs the following errors (I have obscured my Tenant ID from the URL):

  • Message: IDX20803: Unable to obtain configuration from: 'https://login.microsoftonline.com/xxxxxxxx-xxxx-xxxx-xxxx-xxxx/v2.0/.well-known/openid-configuration'. Will retry at '21/03/2024 3:22:28 am +00:00'. Exception: 'System.IO.IOException: IDX20804: Unable to retrieve document from: '[PII of type 'System.String' is hidden. For more details, see https://aka.ms/IdentityModel/PII.]'.
  • ---> System.Net.Http.HttpRequestException: No such host is known. (login.microsoftonline.com:443)
  • ---> System.Net.Sockets.SocketException (11001): No such host is known.

However, if I paste the exact same URL into MS Edge running on the same machine as is hosting the Blazor app, it retrieves the document successfully. The browser uses the proxy configuration from System > Proxy Settings, but Kestrel doesn't seem to use this.

The relevant code from Program.cs is:

builder.Services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)    .AddMicrosoftIdentityWebApp(builder.Configuration.GetSection("AzureAd"));builder.Services.AddControllersWithViews()    .AddMicrosoftIdentityUI();

and in appsettings.json under "AzureAD", it has "Instance": "https://login.microsoftonline.com/", and then the other AzureAD parameters.

Is it possible to either:

  • Tell Kestrel to use the system proxy settings to retrieve this configuration document, or
  • Make some change to the app source so that it does not need to do this step at all? (E.g. can I save the document locally and read it)

Viewing all articles
Browse latest Browse all 4335

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>