3

I created an Asp.Net application and published it a server (Windows Server 2012 R2). It got the following message with the error of Failed to determine the https port for redirect.

PS C:\Users\xxx\Website> .\Blazor.exe
info: Microsoft.Hosting.Lifetime[0]
      Now listening on: http://localhost:5000
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]
      Content root path: C:\Users\xxx\Websites\Portal1
warn: Microsoft.AspNetCore.HttpsPolicy.HttpsRedirectionMiddleware[3]
      Failed to determine the https port for redirect.

However, it doesn't have the error if running on my PC?

info: Microsoft.Hosting.Lifetime[0]
      Now listening on: http://localhost:5000
info: Microsoft.Hosting.Lifetime[0]
      Now listening on: https://localhost:5001
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]
      Content root path: C:\Users\xxx\Downloads\WebSite\WebHub
ca9163d9
  • 27,283
  • 64
  • 210
  • 413
  • It depends on how endpoints are configured, https://learn.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel?view=aspnetcore-3.1#endpoint-configuration When there is not HTTPS endpoint, that error message is expected. – Lex Li Dec 04 '19 at 21:04

1 Answers1

-2

I think your issue is with your appsettings.json file. Without specifying the line:

"https_port": 443,

to indicate which port is the SSL port, Blazor ASP.NET isn't sure where to route the traffic.

COleson
  • 346
  • 3
  • 9