iis强制使用https

方案1:只运行通过https的方式访问,其他的访问方式都删除

1、添加新的网站,绑定类型为“https”,ssl证书选择自建的证书,如何新建自建证书请百度。

2、保证网站绑定中只有https,其他的都删除

 

 3、ssl设置

  

方案2:通过url重定向

1、点击以下下载链接安装64位的URL重写模块:Microsoft URL Rewrite Module。

http://download.microsoft.com/download/C/9/E/C9E8180D-4E51-40A6-A9BF-776990D8BCA9/rewrite_amd64.msi

2、IIS控制台,取消勾选“SSL设置”->“要求 SSL”,右侧工具栏选择“应用”保存。

IIS http重定向https,强制用户使用https访问的配置方法

3、ASP.NET站可直接修改web.config。IIS控制台右键单击需要设置的站点,选择“浏览”,编辑Web.config文件。在system.webServer之间添加以下内容:

web.config
<configuration>
 <system.webServer>
<rewrite>
             <rules>
             <rule name="HTTP to HTTPS redirect" patternSyntax="Wildcard" stopProcessing="true">
             <match url="*" />
             <conditions>
                        <add input="{HTTPS}" pattern="off" />
             </conditions>
               <action type="Redirect" url="https://{SERVER_NAME}{REQUEST_URI}" appendQueryString="false" />
             </rule>  
             </rules>
 </rewrite>
 </system.webServer>
</configuration>
原文地址:https://www.cnblogs.com/guohu/p/14493115.html