In Web API creation exercise, response won't load, claims security issue

McKathlin 0 Reputation points
2024-04-26T16:00:45.5166667+00:00

I'm running a Web API I've set up with the instructions here: https://learn.microsoft.com/en-us/training/modules/build-web-api-aspnet-core/3-exercise-create-web-api

I have not modified this app from its original state. I used dotnet run and it says the Web App is listening on http://localhost:5116 but when I try to navigate there with a browser I can't see a response. If I go to https://localhost:5116 on my browser, I get an error that says "Secure Connection Failed". I've also tried https://localhost:5116, and my console shows the following warning:

warn: Microsoft.AspNetCore.HttpsPolicy.HttpsRedirectionMiddleware[3]

Failed to determine the https port for redirect.

How can I troubleshoot and fix this issue?Warning in Visual Studio Code

Error in Microsoft Edge

This question is related to the following Learning Module

ASP.NET Core Training
ASP.NET Core Training
ASP.NET Core: A set of technologies in the .NET Framework for building web applications and XML web services.Training: Instruction to develop new skills.
25 questions
{count} votes

1 answer

Sort by: Most helpful
  1. AmaranS 6,845 Reputation points Microsoft Vendor
    2024-04-26T16:52:30.96+00:00

    Hi McKathlin,

    Thank you for reaching out to Microsoft Q & A forum. 

    You can right click your application in visual studio and click "Properties".

    Then click "Web" tab and you can find "Project Url" input box. Change the url in this input box from original http://localhost:50997 to https://localhost:44366.

    User's image

    After that, you do not need to change port number manually when you start the application in visual studio. It will browse with https://localhost:44366 automatically.


    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Please feel free to contact us if you have any additional questions.

    If you've found the provided answer helpful, please click the "Accept Answer/Upvote" button. This will be beneficial to other members of the Microsoft Q&A forum community.

    Thank you.

    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.