Local Development of ASP.NET Core Web APIs with HTTPS, SSL, and Self-Signed Certificates

During the local development of ASP.NET Core Web APIs, it is advisable to utilize HTTPS from the outset. This requires an SSL certificate to ensure a secure connection. Typically, Visual Studio automatically generates a self-signed SSL certificate when creating an ASP.NET Core Web API project, especially if HTTPS is considered during project setup. As a result, the new Web API can be securely consumed via HTTPS immediately after project creation.

What to do if the SSL certificate suddenly becomes invalid or is not recognized? Under various circumstances, it can happen that the SSL certificate is not recognized or is no longer recognized. In the internet browser, the following messages are then displayed:

This can have various causes. First, it is advisable to delete the local, self-signed SSL certificates. To do this, simply open the Windows Certificate Manager and delete the localhost certificates as shown below:

Subsequently, a new SSL certificate for local development must be created using the command "dotnet dev-certs https --trust":

en_GBEnglish