[英]Enable SSL in Visual Studio - not prompted to install certificate
我试图按照这篇文章中的说明进行操作: http : //www.codeproject.com/Tips/766918/Visual-Studio-Use-HTTPS-SSL-On-Web-Application-Pro 。 消息“您是否要信任IIS SSL证书?”没有提示我。
证书存储中没有证书出现,如下所示:
请问我做错了什么? 在此处启动 Visual Studio中的应用程序时,请参阅从IE和Firefox收到的警告: 在Visual Studio中启用SSL
通过执行以下步骤,我已经取得了一些进展:
1) Click on the project name then F4 or View -> Properties Window
2) Set SSL Enabled to: True
3) Make a note of the SSL URL that is generated. In my case it is: https://localhost:44334/
4) Right click on the project name and select: Properties
5) Set Project URL to the URL noted in step 3 i.e. https://localhost:44334/
6) Open up a command prompt and run: "C:\Program Files (x86)\Windows Kits\8.1\bin\x64\makecert.exe" -r -pe -n "CN=localhost" -b 01/01/2000 -e 01/01/2036 -eku 1.3.6.1.5.5.7.3.1 -ss my -sr localMachine -sky exchange -sp "Microsoft RSA SChannel Cryptographic Provider" -sy 12.
7) Go to mmc.exe and get the thumbprint of the certificate
8) Run the following from a command line: netsh http add sslcert ipport=0.0.0.0:44334 appid={214124cd-d05b-4309-9af9-9caa44b2b74a} certhash=2f11d025f2bc8802b45ceb7e03632eec333bc1ff. 2f11d025f2bc8802b45ceb7e03632eec333bc1ff is the thumbprint from step 8 and 44334 is the port from step 3.
9) Run: netsh http add urlacl url=https://localhost:44334/ user=Everyone
10) Launch the web app and I see this (
which looks a lot better):
11)转到MMC,找到“个人”证书,然后将其移至:受信任的根证书颁发机构。
然后就可以了。
可以在这篇文章中找到上述所有步骤: http : //www.hanselman.com/blog/WorkingWithSSLAtDevelopmentTimeIsEasierWithIISExpress.aspx 。 我已经总结了我(或其他任何人)将来想参考的步骤-这篇文章很长。 请注意,在我的情况下:applicationhost.config由Visual Studio自动写入,而在链接中,作者建议您手动写入以下文件:C:\\ Users \\ Ian \\ Documents \\ IISExpress \\ config \\ applicationhost.config。 在.vs \\ config文件夹中找到了我的application.config文件。
将IIS Express配置为使用SSL的步骤很多 ,在初次使用时会有些棘手。 必须要做的最重要的部分如下:
MakeCert.exe
生成自签名证书。 查看MakeCert.exe
实用工具的%ProgramFiles(x86)%\\Windows Kits\\10\\bin\\x64
或%ProgramFiles(x86)%\\Windows Kits\\8.1\\bin\\x64
。 该证书还必须导入“受信任的根证书颁发机构”或“第三方根证书颁发机构”中,以使其在本地计算机上(或对于本地用户)受信任。 netsh http add sslcert ...
和netsh http add urlacl ...
或通过使用带有setupFriendlyHostnameUrl
参数的"%ProgramFiles%\\IIS Express\\IisExpressAdminCmd.exe"
实用程序来进行setupFriendlyHostnameUrl
。 %USERPROFILE%\\Documents\\IISExpress\\config\\applicationhost.config
包含网站的新<binding>
问题。 如果仅在Visual Studio内部使用IIS Express,则Visual Studio将在$(solutionDir)\\.vs\\config\\applicationhost.config
文件中插入相应的绑定。 我建议您阅读并遵循Hanselman在2011年发布的旧文章 。该信息今天仍然有罪。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.