我不知道如何让我的 web.config 部署转换适用于重写规则。我尝试了以下方法,但它忽略了它。
<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<system.webServer>
<rewrite xdt:Transform="Replace">
<rules>
<rule name="Force HTTPS On Login/Register" stopProcessing="true">
<match url="Account/Login(.*)|Register(.*)" ignoreCase="true" />
<conditions>
<add input="{HTTPS}" pattern="^OFF$" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:0}" redirectType="Permanent" />
</rule>
<rule name="Force HTTPS Off" stopProcessing="true">
<match url="((Account/Login(.*))|(Register(.*)))" negate="true" ignoreCase="true" />
<conditions>
<add input="{HTTPS}" pattern="^ON$" ignoreCase="true" />
</conditions>
<action type="Redirect" url="http://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
</system.webServer>