zoukankan      html  css  js  c++  java
  • IISExpress cannot find ssl page running localhost with Visual Studio 2017

    Got solution from this post. Had to delete all localhost certificates and repair IIS Express. Thanks @ShaTin

    https://stackoverflow.com/a/22818853/853295

    Make sure to remove any previous 'localhost' certificates as those could conflict with the one generated by IIS Express. I had this same error (ERR_SSL_PROTOCOL_ERROR), and it took me many hours to finally figure it out after trying out many many "solutions". My mistake was that I had created my own 'localhost' certificate and there were two of them. I had to delete both and have IIS Express recreate it.

    Here is how you can check for and remove 'localhost' certificate:

    On Start, type -> mmc.exe, File -> Add/Remove Snap-in..., Select Certificates -> Add> -> Computer account -> Local computer, Check under Certificates > Personal > Certificates. Make sure the localhost certificate that exist has a friendly name "IIS Express Development Certificate". If not, delete it. Or if multiple, delete all. On Visual Studio, select project and under property tab, enable SSL=true. Save, Build and Run. IIS Express will generate a new 'localhost' certificate.

    Note: If it doesn't work, try these: make sure to disable IIS Express on VS project and stopping all running app on it prior to removing 'localhost' certificate. Also, you can go to 'control panel > programs' and Repair IIS Express.

     

    After going to Add/Remove Programs and choosing the "Repair" option on IIS Express, the certificate has been reinstalled and I can now launch IIS Express sites using HTTPS.

    Repair IIS Express

    The certificate is back:

    IIS Express Development Certificate

    And I can now launch the IIS Express site using HTTPS:

    Success!

     

    For Visual Studio 2015, IIS Express 10, Windows 10, these options didn't work for me. IIS Express 10 didn't have a repair option.

    I managed to solve the problem using the IisExpressAdminCmd.exe command available at C:Program Files (x86)IIS Express.

    From an elevated command prompt run:

    cd C:Program Files (x86)IIS Express
    IisExpressAdminCmd.exe setupsslUrl -url:urlToYourSite -UseSelfSigned

    Replacing urlToYourSite with your url.

    e.g.

    cd C:Program Files (x86)IIS Express
    IisExpressAdminCmd.exe setupsslUrl -url:https://localhost:44387/ -UseSelfSigned

    After that I closed IIS Express and restarted my site from Visual Studio and it prompted to automatically trust the self-signed certificate.

    Hope that helps.

  • 相关阅读:
    几数之和的题目
    File类
    递归
    Collections
    Map集合
    泛型
    类型通配符
    可变参数
    异常
    Collection集合
  • 原文地址:https://www.cnblogs.com/FH-cnblogs/p/9395135.html
Copyright © 2011-2022 走看看