On an ASP.NET Core 2.1 I application appSettings file I have the following:
"Kestrel": {
"Certificates": {
"Default": {
"Path": "localhost.pfx",
"Password": "1234"
}
}
}
I created the certificate using the dotnet command:
dotnet dev-certs https -ep "localhost.pfx" -p 1234
And I copied the localhost.pfx file to the project root along the appSettings file.
When I run the project on http://localhost:5000 it is redirected to https://localhost:5001.
However, I receive the browser error saying the connection is not safe and asking me to add an exception.
What am I doing wrong?
--trustflag in thedev-certscommand?dotnet dev-certs https -ep "localhost.pfx" -p 1234 --trust.--trustargument achieves), but you can also just do so manually. However, this only affects browsers that rely on the Windows trusted certificate store, which as far as I'm aware is only IE, Edge, and Chrome. Firefox, in particular, does not, so you still have to add a manual exception in Firefox.