在 asp.net 4.0 和 IIS 7.5 中启用 SSL

发布于 2024-11-05 04:29:17 字数 479 浏览 0 评论 0原文

我创建了一个asp.net 4.0项目。我想为其启用 SSL。我是否需要将此 Web 项目映射到 IIS 中的新网站?当我尝试创建新网站时,我得到:

绑定“*:80:”已分配给另一个网站。如果您向该站点分配相同的绑定,您将只能启动其中一个站点。您确定要添加此重复绑定吗?

我正在尝试关注以下帖子:

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/

我的 IIS 是 7.5.7600.... 我对 ASP.NET 中的 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

旧话新听 2024-11-12 04:29:18

虽然可以配置主机标头来执行您想要的操作,但最简单的方法是使用不同的 IP 地址配置新站点。

将新的 IP 地址添加到服务器,然后在端口 80 和 443 上设置新站点到新 IP 地址的绑定。将应用程序池设置为使用 .NET 4 运行,然后为了更好的体验,您可以添加 URLRewrite 规则通过将其粘贴到 web.config 中,将所有非 SSL 流量推送到 HTTPS:

<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>

或者,如果您想强制使用 SSL,则只需在站点的 IIS 中勾选强制 SSL 选项即可。

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.

℡Ms空城旧梦 2024-11-12 04:29:18

听起来您已经在端口 80 上设置了站点。您的 IIS 可能有默认网站设置。如果您不使用该网站,则可以在按照 Scott Guthrie 博客文章中的步骤操作之前将其删除,这应该可以解决问题。

如果您使用的是默认网站,请在创建新站点时将其端口更改为 81。您可以更改 Scott Guthrie 博客文章中第二张图片所示屏幕中的端口。

如果您想阻止任何非 ssl 流量到达您的新站点,您应该在完成所有设置后删除端口 80(或 81)上的绑定。

It sounds like you already have a site setup on port 80. Your IIS probably has a Default Web Site setup. If you're not using that site, you can delete it before you follow the steps in Scott Guthrie's blog post and that should clear up the issue.

If you are using the Default Web Site, change your new site's port to 81 when you create it. You can change the port in the screen shown by the second image in Scott Guthrie's blog post.

If you want to prevent any non-ssl traffic from reaching your new site, you should delete the binding on port 80 (or 81) after you've finished setting everything up.

樱花落人离去 2024-11-12 04:29:18

要使用 SSL,您必须:

  • 在 IIS 中拥有一个单独的网站
  • 该网站必须有一个单独的 IP 地址,该地址将绑定在端口 443 上

您不能使用主机标头在 IIS 中托管单独的网站并使用 SSL。

查看这篇文章以获取更多帮助:

http://learn.iis.net/page.aspx/144/how-to-set-up-ssl-on-iis-7/

To use SSL you must:

  • Have a separate website in IIS
  • This website must have a separate IP address which will be bound on port 443

You cannot use host headers to host separate websites in IIS and use SSL.

Check this article for more help:

http://learn.iis.net/page.aspx/144/how-to-set-up-ssl-on-iis-7/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文