通過在虛擬機根目錄下的web.config文件中添加以下配置即可使用https,具體方法如下:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="301" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTP_FROM_HTTPS}" pattern="^on$" negate="true" />
</conditions>
<action type="Redirect" url="https://www.baidu.com/{R:1}" redirectType="Permanent" /> # www.baidu.com對應修改為您自已的域名,注釋請自行刪除,不要放入web.config文件內
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>