我遇到了一個令我生氣的問題。 我有一個項目,我設置並啓用了SSL(通過在應用程序屬性更改啓用SSL標誌設置爲true)無法在http中啓動asp.net調試
然後我在網絡媒體的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網址上調試我的應用程序。現在的問題是我必須在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,但它不會。 有人可以幫我嗎?!?