IIS Express 在启用 SSL 时默认为 HTTPS 端口 44300 [英] IIS Express defaulting to port 44300 for HTTPS when enabling SSL

查看:43
本文介绍了IIS Express 在启用 SSL 时默认为 HTTPS 端口 44300的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当您最初设置 IIS Express 以启用 SSL 时,它默认端口为 44300.不幸的是,当我尝试在 https://localhost/ 上访问我的网站时,它不起作用除非我使用端口号 44300 - https://localhost:44300/.

链接是使用以下内容生成的:

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

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

这样做的问题是我要写一些东西来解决一个只会在开发环境中出现的问题.

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

我网站的配置如下:

<应用程序路径="/"><virtualDirectory path="/" physicalPath="C:InetpubMySite"/></应用程序><绑定><binding protocol="http" bindingInformation=":80:"/><binding protocol="https" bindingInformation=":44300:"/></绑定></网站>

非常感谢.

更新:

此问题已由 Divya 在 IIS 论坛上回答.>

解决方案

这个问题已经回答 作者:Divya 在 IIS 论坛上.

<块引用>

在 WebMatrix 中为网站启用 SSL 后,它默认使用端口 44300 并在后台执行所有绑定.我希望您尝试在配置文件中将此端口更改为 443.完成并保存后,您还需要修改 http.sys 中的绑定.您需要删除端口 44300 的现有条目并添加端口 443 的条目.为此,您可以使用 httpcfg (WinXp/Win2003) 或 'netsh http' (WinVista/Win2K8/Win7).以下是 netsh 的命令:

1) 获取现有条目 44300 的 appid 和 certhash(我假设,您将使用与 WebMatrix 相同的证书默认安装.如果您还想更改证书,从证书中获取证书的证书哈希store): netsh http show sslcert.在输出中搜索条目端口 44300 并复制 certhash 和 appID.

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

3) 为 443 端口添加一个新条目,并在步骤中复制了 certhash 和 appID1. netsh http add sslcert ipport=0.0.0.0:443 certhash=appid=

在http.sys中配置好入口后,需要重启http服务以使更改生效.

net stop http

net start http

正如其他人所指出的,有几种不错的方法可以获取您的 SSL 证书.

netsh http show sslcert >输出.txt

或(我的首选方法):

netsh http show sslcert |夹子

When you initially set up IIS Express to enable SSL, it defaults the port to 44300. Unfortunately, when I try to access my site in on https://localhost/ it doesn't work unless I use the port number 44300 - https://localhost:44300/.

The links are generated using the following:

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

Although an ugly solution, the @action keyword can override the generated route, but it means that the application would seemingly need to be aware of any non-standard ports (eg 44300).

The problem with that is that I'd be writing something to solve a problem that would only occur in a development environment.

So my question is... How do I change the port to 443 and have IIS Express like it?

Config for my site is below:

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

Many thanks in advance.

Update:

This question has been answered by Divya over on the IIS forums.

解决方案

This question has been answered by Divya over on the IIS forums.

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

As noted by others, there are several nice ways of getting your SSL certs.

netsh http show sslcert > output.txt

or (my preferred method):

netsh http show sslcert | clip

这篇关于IIS Express 在启用 SSL 时默认为 HTTPS 端口 44300的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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