Thứ Hai, 13 tháng 1, 2025

How to setup certificate for localhost IIS Express

 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
  • Copy localhost certificate from Personal to Trusted Root Certification Certificates
  • After installing the certificate, the application will start normally.
Note: After doing above steps, close the browser then reopen it.

Source: https://learn.microsoft.com/en-us/answers/questions/1330161/iis-express-ssl-certificate-bindings-are-empty

Không có nhận xét nào:

Đăng nhận xét