加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net-mvc – 启用SSL时,IIS默认为HTTPS的端口44300

发布时间:2020-12-15 19:10:14 所属栏目:asp.Net 来源:网络整理
导读:当您最初设置IIS Express以启用SSL时,它默认端口为44300.不幸的是,当我尝试访问我的网站在https:// localhost /它不工作,除非我使用端口号44300 – https: // localhost:44300 /。 链接使用以下内容生成: %= Html.ActionLink("Index","Index","Home",
当您最初设置IIS Express以启用SSL时,它默认端口为44300.不幸的是,当我尝试访问我的网站在https:// localhost /它不工作,除非我使用端口号44300 – https: // localhost:44300 /。

链接使用以下内容生成:

<%= Html.ActionLink("Index","Index","Home",new { @action = "https://" + Request.Hostname + Url.Action("Index","Home") }) %>

虽然一个丑陋的解决方案,@action关键字可以覆盖生成的路由,但这意味着应用程序看起来需要注意任何非标准端口(例如44300)。

问题是,我会写一些东西来解决一个只发生在开发环境中的问题。

所以我的问题是…如何将端口更改为443和IIS Express喜欢它?

我的网站的配置如下:

<site name="MySite" id="2" serverAutoStart="true">
  <application path="/">
    <virtualDirectory path="/" physicalPath="C:InetpubMySite" />
  </application>
  <bindings>
    <binding protocol="http" bindingInformation=":80:" />
    <binding protocol="https" bindingInformation=":44300:" />
  </bindings>
</site>

提前谢谢了。

更新:

这个问题已经是answered由Divya在IIS论坛。

解决方法

这个问题已经是 answered由Divya在IIS论坛。

Once you enable SSL for a website in WebMatrix,it defaults to port 44300 and does all the bindings in the background. I am hoping that you tried to change this port to 443 in the config file. Once that is done and saved,you also need to modify the binding in http.sys. You would need to delete the existing entry for port 44300 and add the entry for port 443.
To do this,you could use httpcfg (WinXp/Win2003) or ‘netsh http’ (WinVista/Win2K8/Win7).
Here are the commands for netsh:

1) Get the appid and certhash for the existing entry of 44300 (I
assume,you are going to use the same certificate which WebMatrix
installs by default. If you want to change the certificate as well,
get the certificate hash of the certificate from the certificate
store): netsh http show sslcert. In the output search for entry for
port 44300 and copy certhash and appID.

2) Delete the entry for 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=<certhash> appid=<appid>

After configuring the entry in http.sys,you need to restart http
service for the changes to take effect.

net stop http

net start http

正如其他人所指出的,有几种很好的方法来获得SSL证书。

netsh http show sslcert > output.txt

或(我的首选方法):

netsh http show sslcert | clip

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读