我有一个包含 6 个项目的解决方案。对于其中的 2 个,我 enabled SSL在项目属性中。 问题是,当我开始调试时,所有 我的项目都以 https 开头,即使它们没有配置为使用 SSL。
例如在启用 SSL 之前,我的项目可以通过 http://localhost:63684/
访问。现在,启用 https 后,我可以在 https://localhost:43000/
下访问我的项目,但是当我尝试访问此 url 时:http://localhost:63684/
,它会自动更改为 https://localhost:63684/
,我在浏览器中收到以下错误:
SSL connection error
ERR_SSL_PROTOCOL_ERROR
Unable to make a secure connection to the server. This may be a problem with the server, or it may be requiring a client authentication certificate that you don't have.
项目也是如此,没有启用 SSL,我无法访问它们。
...\Documents\IISExpress\config\applicationhost.config
文件具有正确的绑定(bind):
<bindings>
<binding protocol="http" bindingInformation="*:63684:localhost" />
<binding protocol="https" bindingInformation="*:44300:localhost" />
</bindings>
还有另外4个项目,没有启用SSL,但仍然自动切换到https:
<bindings>
<binding protocol="http" bindingInformation="*:11483:localhost" />
</bindings>
我已经尝试删除 IISExpress 文件夹,因为我认为配置以某种方式损坏,但没有帮助。
有什么想法会导致自动切换到 https 以及如何修复它吗?
顺便说一句,我正在关注 this在我的 2 个项目中实现 https 时的文章,我的目标是在本地调试时能够使用 http,在项目发布到 web 时能够使用 https。
最佳答案
事实证明,这是一个 Chrome 问题,因为我注意到,在其他浏览器上一切正常。 This SO answer帮我解决了这个问题。
关于asp.net - IIS Express http/https 绑定(bind)无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34097127/