码迷,mamicode.com
首页 > 其他好文 > 详细

IISExpress cannot find ssl page running localhost with Visual Studio 2017

时间:2018-07-31 13:30:52      阅读:167      评论:0      收藏:0      [点我收藏+]

标签:for   gen   build   host   ane   sele   tps   ted   uil   

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.

技术分享图片

The certificate is back:

技术分享图片

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

技术分享图片

 

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.

IISExpress cannot find ssl page running localhost with Visual Studio 2017

标签:for   gen   build   host   ane   sele   tps   ted   uil   

原文地址:https://www.cnblogs.com/FH-cnblogs/p/9395135.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!