当您最初设置 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:\Inetpub\MySite" />
</application>
<bindings>
<binding protocol="http" bindingInformation=":80:" />
<binding protocol="https" bindingInformation=":44300:" />
</bindings>
</site>
提前谢谢了。
更新:
Divya 在 IIS 论坛上已经回答了这个问题。