【问题标题】:Forcing SSL on port 443 in IIS Express for an MVC web application为 MVC Web 应用程序在 IIS Express 中的端口 443 上强制使用 SSL
【发布时间】:2016-01-31 18:34:58
【问题描述】:

我有一个 MVC 5 Web 应用程序部分,我需要使用 SSL 运行其中的部分(谎言登录、帐户管理等)。我为 web 项目启用了 SSL,更改了 applicationhost.config 中的绑定:

<bindings>
    <binding protocol="http" bindingInformation="*:80:example.com" />
    <binding protocol="https" bindingInformation="*:443:example.com" />
</bindings>

但是,当我重新启动 IIS Express 并运行该站点时,它会将 SSL 端口覆盖为 44300。任何想法让它保持在 443?

【问题讨论】:

    标签: asp.net asp.net-mvc ssl iis-express


    【解决方案1】:

    1) netsh http 显示 sslcert。在输出中搜索端口 44300 的条目并复制 certhash 和 appID。

    2) 删除 44300 的条目:netsh http delete sslcert ipport=0.0.0.0:44300

    3) 为端口 443 添加一个新条目,其中包含在步骤 1 中复制的 certhash 和 appID。netsh http add sslcert ipport=0.0.0.0:443 certhash= appid=

    在http.sys中配置条目后,需要重启http服务才能使修改生效。

    net 停止 http

    网络启动http

    【讨论】:

    • 我试过了,成功将证书更改为端口 443(运行etsh http show sslcert 以确保端口 443 显示),然后将 https 绑定更改为端口 443。但是当我在 VS 中打开我的 Web 项目时它会强制绑定再次更改为 44300
    • 好的,我也打开了 csproj 文件,更改了那里的端口,现在它似乎可以正常工作了
    • 太棒了!
    【解决方案2】:

    考虑到您已经映射了正确的绑定。通过右键单击 webapplication 虚拟目录 -> 管理应用程序 -> 高级设置 -> 启用协议,使您的应用程序能够在 IIS 中使用 https

    在 FeaturedView 窗格中单击 SSL Settings 并选中 Require SSL 框并单击应用。

    您可能还想查看此现有帖子IIS Express defaulting to port 44300 for https when enabling SSL

    【讨论】:

    • Rahul - 你描述的是 IIS,而不是 IIS Express
    • @Andrey,啊!我现在看到了。但是你能不能不切换到IIS。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-01-12
    • 1970-01-01
    • 1970-01-01
    • 2015-05-12
    • 2014-07-12
    • 2017-05-04
    • 1970-01-01
    相关资源
    最近更新 更多