Asp.net core 2.1 not starting SSL/HSTS
Posted by Ashish Agrawal on June 26, 2018 16:10
Yesterday I ran into a very interesting issue, I am running my local asp.net 2.1 application with HSTS, but it only start with HTTP port 5000. Even with HSTS on, Kestrel is not picking 5001 for SSL.
Application was not showing any error or any warning. First I thought it is launchSettings.json. But changing it doesn't work.
Then I tried -
dotnet run --server.urls=https://127.0.0.1:5001
This time dotnet showed error that default SSL certificate is missing.
Fix is simple:
dotnet dev-certs https
This command will install default certificate with localhost and now your application will start for both 5000 and 5001 ports.