Hi @Saha, Shubrat,
When IIS Express is installed with Visual Studio, the installation process creates an IIS Express development certificate that acts as an HTTPS certificate for websites running on IIS Express on the local computer. The certificate is valid for five years from the date the certificate was created.
Using HTTPS to connect to a website running in IIS Express will fail when the IIS Express development certificate is not properly bound to the port or the certificate has expired or is installed incorrectly.
You can reset your localhost SSL certificate for IIS Express as follows:
Step 1: Clean up all localhost certificates
- Open "Manage user certificates" in the windows search box.
- Select all localhost certificates in the "Personal/Certificates" folder and delete them.
- Select all localhost certificates in the "Trusted Root Certification Authorities/Certificates" folder and delete them.
- Open "Manage computer certificates" in the windows search box and then do the same things.
Step 2: Using the command line to re-run the setup of the SSL certificate.
- Run cmd as administrator. Navigate to the IIS Express installation directory, the default path is typically:
cd "C:\Program Files (x86)\IIS Express"
- Now execute the following command to re-run the setup for the SSL certificates. Make sure to update the port number to match yours
IisExpressAdminCmd.exe setupsslUrl -url:https://localhost:44321/ -UseSelfSigned
- You will see the following output:
Step 3: Re-run your application using IIS Express.
- Restart Visual Studio and open your application.
- Select IIS Express in Debug/Run Configurations and start the application.
- You will see a popup, please select "Yes" to trust the new self-signed SSL certificate you generated for the localhost app.
- Then a security warning of "Install Certificate" on the local computer will pop up, please select "Yes" to install the certificate.
- After installing the certificate, the application will start normally.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the email notification for this thread.