If you are creating .NET MVC project in VS Code and trying to run project after successfully build . You might see below error. It require https certificate to run.
There are two ways to fix the issue .
1- Create developer certificate by following below command for windows
dotnet dev-certs https
Create developer certificate by following below command for Mac
dotnet dev-certs https --trust
2- Switching back to Kestrel and changing the port number in the applicationUrl setting in the launchSettings.json file fixed the issue.
For the IIS Express error, delete the .vs directory which can be found in the same directory as your solution file if you are using Visual Studio 2019. Thanks to stackoverflow for this fix.