我有一个 web.config 重写规则指定将所有流量移动到 https。该规则有效,但我不希望在调试时需要 SSL。我已经完成了一堆 web.release.config 转换,这些转换已经在发布时工作,所以我决定在那里放置一个重写规则。问题是重写规则没有像其他设置一样被转换。这是 web.config 设置:
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules runAllManagedModulesForAllRequests="true"/>
<rewrite></rewrite>
</system.webServer>
这是正在进行的转换:
<system.webServer>
<rewrite>
<rules>
<rule name="Redirect 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></system.webServer>
如果我只是将重写规则复制到 web.config 它工作正常。有没有人知道为什么 web.Release.config 转换仅适用于本节?