简体   繁体   English

IISExpress 找不到使用 Visual Studio 2013 运行本地主机的 ssl 页面

[英]IISExpress cannot find ssl page running localhost with Visual Studio 2013

When I access the site as http://localhost:26049 , the site runs fine.当我以http://localhost:26049访问该站点时,该站点运行良好。 If I try to access the site with https://localhost:44319 , I get page not found.如果我尝试使用https://localhost:44319访问该站点,则会找不到页面。

This is my project properties:这是我的项目属性:

项目属性

This is from my IISExpress application config:这是来自我的 IISExpress 应用程序配置:

<site name="MVC Authentication" id="2">
    <application path="/" applicationPool="Clr4IntegratedAppPool">
        <virtualDirectory path="/" physicalPath="F:\Projects\MySite\Test" />
    </application>
    <bindings>
        <binding protocol="https" bindingInformation="*:44319:localhost" />
        <binding protocol="http" bindingInformation="*:26049:localhost" />
    </bindings>
</site>

Please, for the love of g*d, try this, before you get mired in some unnecessary craziness!为了 g*d 的爱,请尝试此操作,以免陷入不必要的疯狂!

(Apparently IIS Express has reserved port range of 44300 - 44399 for simulating SSL ) (显然IIS Express为模拟SSL保留了44300 - 44399 的端口范围)

Change to port 44300 (https://localhost:44300/)更改为端口 44300 (https://localhost:44300/)

Got solution from this post.从这篇文章中得到了解决方案。 Had to delete all localhost certificates and repair IIS Express.不得不删除所有本地主机证书并修复 IIS Express。 Thanks @ShaTin谢谢@沙田

https://stackoverflow.com/a/22818853/853295 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.确保删除任何以前的“本地主机”证书,因为这些证书可能与 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".我遇到了同样的错误(ERR_SSL_PROTOCOL_ERROR),在尝试了许多“解决方案”后,我花了好几个小时才最终弄明白。 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.我不得不删除两者并让 IIS Express 重新创建它。

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.在开始,键入 -> mmc.exe,文件 -> 添加/删除管理单元...,选择证书 -> 添加> -> 计算机帐户 -> 本地计算机,在证书 > 个人 > 证书下检查。 Make sure the localhost certificate that exist has a friendly name "IIS Express Development Certificate".确保存在的本地主机证书具有友好名称“IIS Express 开发证书”。 If not, delete it.如果没有,请将其删除。 Or if multiple, delete all.或者如果有多个,则全部删除。 On Visual Studio, select project and under property tab, enable SSL=true.在 Visual Studio 上,选择项目并在属性选项卡下启用 SSL=true。 Save, Build and Run.保存、构建和运行。 IIS Express will generate a new 'localhost' certificate. IIS Express 将生成一个新的“本地主机”证书。

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.注意:如果它不起作用,请尝试以下操作:确保在 VS 项目上禁用 IIS Express 并在删除“本地主机”证书之前停止其上所有正在运行的应用程序。 Also, you can go to 'control panel > programs' and Repair IIS Express.此外,您可以转到“控制面板> 程序”并修复 IIS Express。

The steps followed by me to resolve this (I am using vs2015)我遵循的解决此问题的步骤(我使用的是 vs2015) 在此处输入图片说明

1)Go to control panel 1)进入控制面板

2)Add Remove Programs 2)添加删除程序

3)Repair IIS Express 3)修复IIS Express

4)Restarted my computer 4)重新启动我的电脑

4)Next go to my documents->IIS Express->Config Files 4)接下来进入我的文档->IIS Express->Config Files

5)Take a copy of them and Remove those files from there 5)复制它们并从那里删除这些文件

6)Delete all items C:\\Temp 6) 删除所有项目 C:\\Temp

7)Check for .vs folder in your sln file and goto config folder in it 7)检查 sln 文件中的 .vs 文件夹并转到其中的 config 文件夹

8)Take a copy of that as well and remove the files inside it 8)也复制一份并删除其中的文件

9)Clean your solution 9)清洁您的解决方案

10)Restart Visual studio 10)重启Visual Studio

11)Build and run 11)构建并运行

(I copied clean config files from my colleagues machine - in locations mentioned above (我从我的同事机器复制了干净的配置文件 - 在上面提到的位置
1]In Documents 1]在文件中
2] .vs folder 2] .vs 文件夹
I suppose Just running IISExpress and it will recreate the file for you.我想只要运行 IISExpress,它就会为您重新创建文件。 The exe is located at: "c:\\Program Files\\IIS Express\\iisexpress.exe". exe 位于:“c:\\Program Files\\IIS Express\\iisexpress.exe”。 ) )

It looks like IIS Express is not starting the project under the https URL.看起来 IIS Express 没有在 https URL 下启动项目。 Try changing the default project URL to the SSL one in尝试将默认项目 URL 更改为 SSL 中的一个

"Web Project->Properties->Web->Project URL" to the URL with https. “Web Project->Properties->Web->Project URL”到带有https的URL。

在此处输入图片说明

In my case on a previous run the IIS Express added a certificate (called localhost) to the Personal > Certificates folder.在我之前运行的情况下,IIS Express 在 Personal > Certificates 文件夹中添加了一个证书(称为 localhost)。 But I was getting an invalid certificate error in the application.但是我在应用程序中收到无效证书错误。 So I moved the localhost certificate to the Trusted Root...> Certificates and everything started to work.因此,我将 localhost 证书移至 Trusted Root...> Certificates,一切都开始工作了。

The next day when I run the same application I started to get this ERR_CONNECTION_RESET error.第二天,当我运行相同的应用程序时,我开始收到此 ERR_CONNECTION_RESET 错误。 All I had to do is to move the localhost certificate out of the Trusted Root...> Certificates folder and back to the Personal > Certificates folder.我所要做的就是将本地主机证书移出受信任的根目录...> 证书文件夹,然后移回个人 > 证书文件夹。 在此处输入图片说明

In case the "localhost" certificate is missing in either of the folders then you have to repair/reinstall IIS Express from Control Panel > Add/Remove Programs.如果任一文件夹中缺少“localhost”证书,则您必须从“控制面板”>“添加/删除程序”修复/重新安装 IIS Express。 This will reinstate the localhost certificate.这将恢复本地主机证书。

Visual Studio 2015, IIS Express, Windows 8, Asp.net MVC Visual Studio 2015、IIS Express、Windows 8、Asp.net MVC

I was having these SSL issues with Chrome and Edge.我在 Chrome 和 Edge 上遇到了这些 SSL 问题。

After a long process of reviewing all these answers and suggestions, what eventually worked for me (asp.net mvc 5, VS2015) was a mix of the answers above经过漫长的审查所有这些答案和建议的过程后,最终对我有用的(asp.net mvc 5,VS2015)是上述答案的混合

  1. Add Certificates snap in as shown above, removing mutlitple certs and regenerate a new certificat: Thanks @garethb如上所示添加证书管理单元,删除多个证书并重新生成新证书:谢谢@garethb
  2. The issue then is around the trust level of that certificate.那么问题就在于该证书的信任级别。 The following link shows step by step process to export and then import (not just move) the local certificate https://blogs.msdn.microsoft.com/robert_mcmurray/2013/11/15/how-to-trust-the-iis-express-self-signed-certificate/以下链接显示了导出然后导入(不仅仅是移动)本地证书的分步过程https://blogs.msdn.microsoft.com/robert_mcmurray/2013/11/15/how-to-trust-the-iis -express-self-signed-certificate/

    1. When closing everything and then rebuild and deploy into IIS Express, I no longer have the SSL errors in any browser关闭所有内容然后重建并部署到 IIS Express 时,我在任何浏览器中都不再出现 SSL 错误

I had the same problem.我有同样的问题。 My HTTP site was running fine, but IIS Express just wouldn't start my SSL site.我的 HTTP 站点运行良好,但 IIS Express 无法启动我的 SSL 站点。 While it did the day before.虽然前一天做了。

My problem was that I had somehow messed up the aplicationhost.config file.我的问题是我以某种方式弄乱了 aplicationhost.config 文件。 My project was registered twice:我的项目注册了两次:

<site name="Test.Api" id="5">
    <application path="/" applicationPool="Clr4IntegratedAppPool">
        <virtualDirectory path="/" physicalPath="C:\Users\bartd\Source\Repos\Test\Test.Api" />
    </application>
    <bindings>
        <binding protocol="http" bindingInformation="*:27108:localhost" />
    </bindings>
</site>
<site name="Test.Api(1)" id="6">
    <application path="/" applicationPool="Clr4IntegratedAppPool">
        <virtualDirectory path="/" physicalPath="C:\Users\bartd\Source\Repos\Test\Test.Api" />
    </application>
    <bindings>
        <binding protocol="http" bindingInformation="*:27108:localhost" />
        <binding protocol="https" bindingInformation="*:44349:localhost" />
    </bindings>
</site>

Removing both entries and creating a new virtual directory from the project properties page fixed the problem for me.从项目属性页面删除这两个条目并创建一个新的虚拟目录为我解决了这个问题。

Creating a new virtual directory from the properties page从属性页创建一个新的虚拟目录

None of these options worked for me in VS2017 with the same problem.在 VS2017 中,这些选项都没有对我有用,但有同样的问题。 This solution using iisexpresscmdadmin with a self-signed cert got my site to finally pull up:这个使用带有自签名证书的 iisexpresscmdadmin 的解决方案让我的网站最终启动:

How do I fix a missing IIS Express SSL Certificate? 如何修复丢失的 IIS Express SSL 证书?

Using VS 2017, none of these solutions seemed to work, even after exporting certificate and importing into Chrome.使用 VS 2017,即使在导出证书并导入 Chrome 之后,这些解决方案似乎都不起作用。 It finally worked after I did two things: (1) copied the localhost certificate from Personal to Trusted Root (2) changed the port number in project properties from 61899 to 44300 I think doing just step (2) did the trick.在我做了两件事后,它终于奏效了:(1) 将本地主机证书从 Personal 复制到 Trusted Root (2) 将项目属性中的端口号从 61899 更改为 44300 我认为只执行步骤 (2) 就可以了。

Try changing bindings in IIS尝试更改 IIS 中的绑定

This link is what solved my 3 day long intermittent headache: https://deanhume.com/set-up-iis-7-to-run-a-secure-site-locally-https/这个链接解决了我为期 3 天的间歇性头痛: https : //deanhume.com/set-up-iis-7-to-run-a-secure-site-locally-https/

Here are the specific steps that lead to my discovery of the real problem:以下是导致我发现真正问题的具体步骤:

Windows key > Administrative tools > Internet Information Services > Click on Default Website (or whatever your website is) > Bindings... > Blow all the duplicate bindings away for local host > Add https binding for port 80 . Windows 键 > 管理工具 > Internet 信息服务 > 单击默认网站(或任何您的网站) > 绑定... > 清除本地主机的所有重复绑定 > 为端口 80 添加 https 绑定

0 0

I recently had a very similar problem with VS 2019 and IIS Epress.我最近在 VS 2019 和 IIS Epress 上遇到了一个非常相似的问题。 I tried to change the http to https so that I could use ADFS.我试图将 http 更改为 https 以便我可以使用 ADFS。 https://i.stack.imgur.com/Kd34a.png https://i.stack.imgur.com/Kd34a.png

After a little more research, I tried to switch the 'Require SSL' property from true to false and back to true.经过更多研究,我尝试将“需要 SSL”属性从 true 切换为 false,然后再切换回 true。 This triggered an update to the applicationhost.config file (... . Vs \\ ProjectName \\ config \\ applicationhost.config) that created a new SSL binding with a new port number for the https protocol.这触发了对 applicationhost.config 文件(... . Vs \\ ProjectName \\ config \\ applicationhost.config)的更新,该文件使用 https 协议的新端口号创建了新的 SSL 绑定。 So, I modified all the links with the proposed new port (in the web property of the project, the config file and the ADFS config) and it works.因此,我使用建议的新端口(在项目的 Web 属性、配置文件和 ADFS 配置中)修改了所有链接,并且它可以工作。 Conclusion, it is not necessary that the http port is the same as https same for the same site.结论,对于同一站点,http 端口不必与 https 相同。

在我的情况下,只需从 Edge 切换到 Chrome 即可立即解决此问题(VS 2019 Pro / Windows 10 最新版)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM