【问题标题】:Deploying to IIS removes URL rewrite rules?部署到 IIS 会删除 URL 重写规则?
【发布时间】:2018-09-12 09:20:59
【问题描述】:

我配置了两个发布配置文件以将网站部署到 IIS。

第一个基于 FTP,第二个基于 MS Web Deploy。

这两种部署方法都删除了 URL 重写规则,但是,这不是我想要的。

我应该如何配置 IIS、发布配置文件或 Web.config 以防止删除我的规则?

【问题讨论】:

    标签: iis deployment iis-7 web-config msdeploy


    【解决方案1】:

    解决方案: 我必须补充:

    <rewrite>
      <rules>
        <rule name="http to https" stopProcessing="true">
          <match url="(.*)" />
          <conditions>
            <add input="{HTTPS}" pattern="^OFF$" />
          </conditions>
          <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="SeeOther" />
        </rule>
      </rules>
    </rewrite>
    

    我的 web.config 文件。我项目中的 web.config 不知何故覆盖了 iss 规则

    【讨论】:

      【解决方案2】:

      此规则存储在 web.config 中。如果您部署并覆盖 web.config,则此规则将消失。不要覆盖 web.config,应该就是这样。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2012-05-03
        • 2014-10-27
        • 2014-05-01
        • 2011-04-21
        • 1970-01-01
        • 2019-08-22
        相关资源
        最近更新 更多