在asp.net中启用SSL 4.0和IIS 7.5 [英] Enabling SSL in asp.net 4.0 and IIS 7.5

查看:635
本文介绍了在asp.net中启用SSL 4.0和IIS 7.5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建一个asp.net 4.0项目。我想启用SSL它。我需要这个映射Web项目在IIS中的新网站。当我尝试创建一个新的网站,我得到:

的结合'*:80:被分配给其他站点。如果您分配相同的结合到这个网站,你将只能启动网站之一。你确定要添加这个重复的绑定?

我试图遵循以下职位:

<$p$p><$c$c>http://weblogs.asp.net/scottgu/archive/2007/04/06/tip-trick-enabling-ssl-on-iis7-using-self-signed-certificates.aspxhttp://mscrm4humans.word$p$pss.com/2010/06/24/enabling-ssl-on-iis-7-0-using-self-signed-certificates/

我的IIS是7.5.7600 ....
我完全新的SSL在asp.net中。请建议解决这个问题。


解决方案

虽然可以配置主机头,你在做什么之后,最简单的方法是用不同的IP地址配置新网站。

添加新的IP地址到服务器,然后设置你的新网站在端口80和443的新的IP地址设置应用程序池使用.NET 4运行绑定,那么对于一个很好的接触,你可以添加一个URLRewrite规则,在你的web.config坚持这一推所有非SSL流量到https:

 &LT; system.webServer&GT;
      &LT;&改写GT;
        &LT;规则与GT;
            &LT;规则名称=重定向到HTTPSsto​​pProcessing =真&GT;
                &LT;匹配URL =(。*)/&GT;
                &LT;条件&gt;
                    &LT;添加输入={} HTTPS模式=^ $ OFF/&GT;
                &所述; /条件&gt;
                &lt;作用TYPE =重定向URL =htt​​ps://开头{HTTP_HOST} / {R:1}redirectType =SeeOther/&GT;
            &LT; /规则&GT;
        &LT; /规则&GT;
    &LT; /重写&GT;
&LT; /system.webServer>

或者,如果你想强制SSL然后只需勾选该网站在IIS中的强制SSL 选项。

I have created an asp.net 4.0 project. I want to enable SSL for it. Do I need to map this web project to new website in IIS. When I try to create a new website, I get:

The binding '*:80:' is assigned to another site. If you assign the same binding to this site, you will only be able to start one of the sites. Are you sure that you want to add this duplicate binding?

I am trying to follow the following posts:

http://weblogs.asp.net/scottgu/archive/2007/04/06/tip-trick-enabling-ssl-on-iis7-using-self-signed-certificates.aspx

http://mscrm4humans.wordpress.com/2010/06/24/enabling-ssl-on-iis-7-0-using-self-signed-certificates/

my IIS is 7.5.7600.... I am totally new to SSL in asp.net. Please suggest solution to this issue.

解决方案

Whilst it is possible to configure host headers to do what you're after, the easy way is to configure your new site with a different IP address.

Add the new IP address to the server, then setup your binding for the new site to the new IP address on port 80 and 443. Set the app pool to run using .NET 4, then for a nice touch you could add a URLRewrite rule to push all non-SSL traffic to HTTPS by sticking this in your web.config:

<system.webServer>
      <rewrite>
        <rules>
            <rule name="Redirect to HTTPS" stopProcessing="true">
                <match url="(.*)" />
                <conditions>
                    <add input="{HTTPS}" pattern="^OFF$" />
                </conditions>
                <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="SeeOther" />
            </rule>
        </rules>
    </rewrite>
</system.webServer>

Or if you wanted to force SSL then just tick the Force SSL option in IIS for the site.

这篇关于在asp.net中启用SSL 4.0和IIS 7.5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆