【问题标题】:Can't start asp.net debug in http无法在 http 中启动 asp.net 调试
【发布时间】:2017-09-12 23:27:30
【问题描述】:

我有一个让我发疯的问题。 我有一个项目,我设置并启用了 SSL(通过在应用程序属性中将启用 SSL 的标志更改为 true)

然后我将 web 属性中的项目 url 更改为 SSL Url(如上图所示)

最后,我在 web.config 中添加了一个重写规则:

<rewrite>
    <rules>
        <rule name="HTTP to HTTPS redirect" stopProcessing="true">
            <match url="(.*)" />
            <conditions>
                <add input="{HTTPS}" pattern="off" ignoreCase="true" />
            </conditions>
            <action type="Redirect" redirectType="Permanent" url="https://{HTTP_HOST}{REQUEST_URI}" />
        </rule>
    </rules>
</rewrite>

这一切都很好。我能够在新的 HTTPS url 上调试我的应用程序。问题是现在我必须在 HTTP 上重新测试它,所以我颠倒了我的步骤。 首先我注释掉了重写规则,然后我将 Project Url 改回正常的 http url 并单击“创建虚拟目录”。 最后,我将“启用 SSL”更改为 false。

这就是问题所在。当我按 F5 时,我的浏览器使用正常的 URL(正确的 http 之一),但它重定向到 https url。我无法更改它,因为当我这样做时它只是重定向。 这让我发疯,因为没有规则(我能找到)正在重定向它。我什至取消了我的重写规则的注释并将其更改为:

<rewrite>
    <rules>
        <rule name="HTTP to HTTPS redirect" stopProcessing="true">
            <match url="(.*)" />
            <conditions>
                <add input="{HTTPS}" pattern="off" ignoreCase="true" />
            </conditions>
            <action type="Redirect" redirectType="Permanent" url="http://{HTTP_HOST}{REQUEST_URI}" />
        </rule>
    </rules>
</rewrite>

让它使用http url,但它不会。 有人可以帮帮我吗?!?

【问题讨论】:

    标签: visual-studio ssl


    【解决方案1】:

    最后,这很简单。我注释掉了重写规则,然后在项目属性中,只需将 override application root url 设置为 http url,同时将 project url 保留为 https 版本。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-04-26
      • 2011-04-08
      • 1970-01-01
      • 1970-01-01
      • 2018-02-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多