Dan*_*son 36 asp.net-mvc ssl https iis-express
当您最初设置IIS Express以启用SSL时,它会将端口默认为44300.不幸的是,当我尝试访问我的网站时,https://localhost/
它不起作用,除非我使用端口号44300 - https://localhost:44300/
.
使用以下内容生成链接:
<%= Html.ActionLink("Index", "Index", "Home", new { @action = "https://" + Request.Hostname + Url.Action("Index", "Home") }) %>
Run Code Online (Sandbox Code Playgroud)
虽然这是一个丑陋的解决方案,但@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>
Run Code Online (Sandbox Code Playgroud)
提前谢谢了.
更新:
Divya已经在IIS论坛上回答了这个问题.
Dan*_*son 28
Divya已经在IIS论坛上回答了这个问题.
在WebMatrix中为网站启用SSL后,默认为端口44300并在后台执行所有绑定.我希望您尝试在配置文件中将此端口更改为443.完成并保存后,您还需要修改http.sys中的绑定.您需要删除端口44300的现有条目并添加端口443的条目.为此,您可以使用httpcfg(WinXp/Win2003)或'netsh http'(WinVista/Win2K8/Win7).以下是netsh的命令:
1)获取44300的现有条目的appid和certhash(我假设您将使用默认安装WebMatrix的相同证书.如果您还想更改证书,请从证书中获取证书的哈希值证书存储区)
netsh http show 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=<certhash> appid=<appid>
在http.sys中配置条目后,需要重新启动http服务才能使更改生效.
net stop http
net start http
正如其他人所指出的,有几种很好的方法可以获得SSL证书.
netsh http show sslcert > output.txt
Run Code Online (Sandbox Code Playgroud)
或(我的首选方法):
netsh http show sslcert | clip
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
27252 次 |
最近记录: |