对于本地主机,从Visual Studio调试获得[ERR_SSL_PROTOCOL_ERROR

问题描述 投票:1回答:1

我正在运行一个简单的ASP.net Web应用程序。运行此选项后,Chrome浏览器显示以下错误。

localhost sent an invalid response.
Try running Windows Network Diagnostics.
ERR_SSL_PROTOCOL_ERROR

但是我在Http上的应用程序,而不是HTTPS。

enter image description here

但是使用https://localhost:54056/加载URL

配置也仅指向http

 <site name="tan-square" id="2">
            <application path="/" applicationPool="Clr4IntegratedAppPool">
                <virtualDirectory path="/" physicalPath="C:\Users\Myfolder\OneDrive\Downloads\tan-square" />
            </application>
            <bindings>
                <binding protocol="http" bindingInformation="*:54056:localhost" />
            </bindings>
        </site>

我不明白问题出在哪里?如何通过https加载?

asp.net .net google-chrome iis iis-express
1个回答
0
投票

首先,通过以下详细信息检查您的网站Web绑定详细信息:

1)打开Visual Studio,选择您的项目。

2)右键单击项目并选择属性。

3)在“ Web”选项卡下,并检查您的项目URL。

enter image description here

确保您的web.conifg文件中没有这样的设置,如下所示:

<system.webServer>
    <httpProtocol>
      <customHeaders>
        <add name="Strict-Transport-Security" 

        value="max-age=16070400; includeSubDomains" />
      </customHeaders>
    </httpProtocol>
</system.webServer>

当浏览器看到此消息时,它将记住,在给定的秒数内,仅应通过HTTPS与当前域联系。将来,如果用户键入http://或省略该方案,则默认为HTTPS。

清除浏览器缓存。您可能试图找到原因的另一件事是开放的chrome。在网址中输入chrome:// net-internals /#hsts并查询localhost:

enter image description here

查询显示“本地主机”在HSTS集中的域列表中。

解决方案是从缓存中删除域。在“删除域”文本字段中输入“ localhost”,然后单击“删除”。执行完此操作后,再次查询“ localhost”时,将收到“找不到”。

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.