I am currently experimenting with an app I am writing with Blazor (server-side) and ASP.NET Core. However, I’ve had some issues with HTTPS while running the apps with dotnet cli locally. The solution, it turned out, was rather simple. With .NET Core it’s just a matter of one simple command to enable HTTPS locally and issue a certificate.
dotnet dev-certs https --trust
After you run this inside your console a prompt would pop up asking you to confirm and install this certificate locally on your machine.
After you approve this your certificate would be added to your local machine and you’ll get a message similar to this one in your console:
After that you should restart your browser and you’ll have a valid certificate, like the one shown below
If you want to remove your certificates you could do that as well with the following command:
dotnet dev-certs https --clean
For more information regarding the options available you could use the help command:
dotnet dev-certs https --help
which would show you everything available for you to play with