Last updated 1 year ago by Matthew Blottdotnet
You pretty have to use SSL these days but getting started with ASP.NET Core was a bit of a challenge for me. As usual I had to scour the net for bits of information and then cobble a solution together and this post is basically what I did to get from development to production. The code for this tutorial can be found here. Development (macOS)
First it’s nice to use SSL in development so your coding environment best simulates what you’ll be doing in production. There’s an excellent post here on setting up SSL locally with ASP.NET Core. It’s well worth reading so I won’t go into too much detail but this is basically what you need to do.
First create a certificate and key using openssl. Create a localhost.conf file for the default values like mine here and substitute password at the end for something else (if desired).
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout localhost.key -out localhost.crt -config localhost.conf -passin pass:password