一、添加 “ URL重写 ” 模块
二、添加http和https类型的域名绑定
三、在项目访问根目录添加文件web.config
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Redirect to https" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="^OFF$" />
<add input="{HTTPS_HOST}" pattern="^(localhost)" negate="true" />
conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent" />
rule>
rules>
rewrite>
system.webServer>
configuration>