IIS express ssl certificate bindings are empty

Saha, Shubrat 5 Reputation points
2023-07-14T11:31:41.44+00:00

IIS express certificate expired on my system, leading to site can't be reached errors while debugging the application.

I tried bunch of things such as repairing or reinstalling IIS Express, Visual Studio. But later, I found out that SSL certificate bindings are empty and I tried to add SSL certificate (IIS Express Development Certificate) using netsh.

Can you please share the steps that needs to be followed into order to regenerate SSL Certificate bindings?

Sharing screenshots here for reference:

User's image

User's image

Internet Information Services
.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,480 questions
Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,722 questions
{count} vote

1 answer

Sort by: Most helpful
  1. Yurong Dai-MSFT 2,806 Reputation points Microsoft Vendor
    2023-07-17T08:12:11.42+00:00

    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.User's image
    • Select all localhost certificates in the "Trusted Root Certification Authorities/Certificates" folder and delete them. User's image
    • 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: User's image

    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. User's image
    • Then a security warning of "Install Certificate" on the local computer will pop up, please select "Yes" to install the certificate. User's image
    • 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.

    Best regards,

    Yurong Dai

    5 people found this answer helpful.