Timberfist
Timberfist
CC#
Created by Timberfist on 2/27/2024 in #help
New webapi Project Doesn't Listen On https Port
I'm working through the "Create a web API with ASP.NET Core controllers" module on Microsoft Learn (https://learn.microsoft.com/en-gb/training/modules/build-web-api-aspnet-core/). I've created a new project using dotnet new webapi -controllers -f net8.0and run it using dotnet run. The module states that I should see something like this in the terminal:
Building...
info: Microsoft.Hosting.Lifetime[14]
Now listening on: https://localhost:7294
info: Microsoft.Hosting.Lifetime[14]
Now listening on: http://localhost:5118
info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Development
Building...
info: Microsoft.Hosting.Lifetime[14]
Now listening on: https://localhost:7294
info: Microsoft.Hosting.Lifetime[14]
Now listening on: http://localhost:5118
info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Development
The two lines relating to https are missing for me. If I attempt to connect to the service using https://localhost:7294/weatherforecast then the connection times out. According to the module, this should work. If I connect to http://localhost:5118/weatherforecast then it works fine. I checked that I have a trusted development certificate with dotnet dev-certs https --check --trust and it reports that I do. If I open "Manage Certificates" in Microsoft Edge, I can see it. Does anyone have any idea why my service is not listening on the https port?
9 replies