简体   繁体   English

在MVC Web应用程序的IIS Express中的端口443上强制使用SSL

[英]Forcing SSL on port 443 in IIS Express for an MVC web application

I have an MVC 5 web application parts of which I need to run using SSL (lie login, account management etc). 我有一个MVC 5 Web应用程序部分,我需要使用SSL运行该部分(谎言登录,帐户管理等)。 I enabled SSL for the web project, changed bindings in applicationhost.config : 我为Web项目启用了SSL,更改了applicationhost.config绑定:

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

But, when I restart IIS Express and run the site, it overwrites the SSL port to 44300. Any ideas to make it stay at 443? 但是,当我重新启动IIS Express并运行该站点时,它将SSL端口覆盖为44300。是否有任何使其保留在443上的想法?

1) netsh http show sslcert. 1)netsh http显示sslcert。 In the output search for entry for port 44300 and copy certhash and appID. 在输出中搜索端口44300的条目,并复制certhash和appID。

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

3) Add a new entry for port 443 with certhash and appID copied in step 1. netsh http add sslcert ipport=0.0.0.0:443 certhash= appid= 3)为端口443添加新条目,并在步骤1中复制certhash和appID。netsh http add sslcert ipport = 0.0.0.0:443 certhash = appid =

After configuring the entry in http.sys, you need to restart http service for the changes to take effect. 在http.sys中配置条目后,您需要重新启动http服务以使更改生效。

net stop http 净停止http

net start http 净启动http

Considering that you have mapped proper bindings. 考虑到您已经映射了正确的绑定。 enable your application to use https in IIS by right click on webapplication virtual directory -> manage Application -> advance setting -> Enable Protocols 通过右键单击Web应用程序虚拟目录->管理应用程序->高级设置->启用协议,使您的应用程序在IIS中使用https

在此处输入图片说明

In FeaturedView pane click SSL Settings and check the box says Require SSL and click Apply. 在FeaturedView窗格中,单击“ SSL Settings然后选中“ Require SSL ”框,然后单击“应用”。

在此处输入图片说明

You may also want to look at this existing post IIS Express defaulting to port 44300 for https when enabling SSL 启用S​​SL时,您可能还需要查看IIS Express的现有帖子, 默认为https的端口44300

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么 SSL 443 无法在 IIS Express 中用于 Visual Studio Web 项目的自定义域? - Why does SSL 443 fail to work in IIS Express for custom domains of Visual Studio web projects? 运行IIS和WCF应用程序在同一端口上侦听时发生冲突(443) - Conflict when running IIS and WCF application listening on the same port (443) IIS:Websocket和IIS共享端口443 - IIS: Websocket and IIS sharing port 443 Visual Studio Debug说无法启动IIS Express Web服务器(无法注册localhost:443) - Visual Studio Debug says Unable to launch IIS Express Web server (failed to register localhost:443) 无法启动IIS Express Web服务器端口80 - Unable to launch the IIS express web server port 80 is in use 如何在保持端口443打开的同时禁用IIS上的端口80? - How to disable port 80 on IIS while keeping port 443 open? ASP.NET 5 MVC:无法连接到 Web 服务器“IIS Express” - ASP.NET 5 MVC: unable to connect to web server 'IIS Express' 是否可以在Visual Studio 2015的其他端口中发布asp.net Web API? IIS不是IIS Express - Is it possible to publish asp.net web api in a different port in Visual Studio 2015 ? IIS not IIS Express Web应用程序存在于本地IIS Web服务器和IIS Express Web服务器上 - web application exists on both the local IIS web server and the IIS Express web server IIS 8.5-更改我的Web服务应用程序在其上运行的端口 - IIS 8.5 - Change the port my web service application runs on
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM