How to fix this error "warn: Microsoft.AspNetCore.HttpsPolicy.HttpsRedirectionMiddleware[3] Failed to determine the https port for redirect."

Vaishnavi P 80 Reputation points
2023-06-03T08:29:57.58+00:00

Good evening , I am trying to build a simple web api using ASP.Net . The app has been showing the error like this after building it -

warn: Microsoft.AspNetCore.HttpsPolicy.HttpsRedirectionMiddleware[3]
      Failed to determine the https port for redirect.

I have built according to this documentation-
https://learn.microsoft.com/en-in/training/modules/build-web-api-aspnet-core/3-exercise-create-web-api

Developer technologies ASP.NET ASP.NET Core
{count} votes

12 answers

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  2. Habeebullahi Lawal 0 Reputation points
    2025-01-24T10:40:15.7866667+00:00

    In the launchSettings.json file, move the https property to the top of the http property. Both of them will work and http requests will be redirected to the https port (as long as you don't disable the UseHttpsRedirection() in the Program.cs file).

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.