Recently I need to simulate production environment (in a case of secure connection) to check application behavior so I quickly searched Asp.Net Core docs and find this article. I followed IIS Express approach, once I finished setup and tried to run the application then I ran into an issue on Chrome and Firefox but OK with Edge. That’s strange and based on the error shown by chrome I was guessing this is not application fault but something wrong with browsers.
So after few google search, I came to know that chrome recently removed support for CommonName matching in certificates. This thread helped me to solve this issue. David Beer has the best solution to fix this issue. Kudos to David!!
His has written PowerShell script that generates a new certificate, removes the old certificate assignments from the IISExpress SSL ports and adds the newly generated one. The certificate is also copied over to the Trusted Root Certificate Authorities.
- As mentioned in answer go to GitHub gist page and copy the PowerShell script
- Go to windows search bar and search Powershell ISE by keyword “ise”
- Run ISE on administrator mode
- Paste the script and hit F5 or Run button
- This will remove old certificate and generates new one
Now again run your application and you will see a green badge on your URL.
Good News, Asp.Net Core Team has fixed this issue for an upcoming release. Later you don’t have to run this script. Steps of docs will be enough.
Happy Coding. 🙂