将VS2013设置为使用自定义域,如下所示:
http://mydomain.local
https://mydomain.local端口80 url工作得很好,端口443不工作(坏请求,不能显示页面,也就是站点不存在)。
为什么?
显然,IIS很难用这个名称映射或使用端口443,但为什么呢?
applicationhost.config:
<site name="MyDomain" id="16">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Projects\MyDomain" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:80:MyDomain.local" />
<binding protocol="https" bindingInformation="*:443:MyDomain.local" />
</bindings>
</site>主机文件:
127.0.0.1 MyDomain.local与项目属性:
Start Url、Project和覆盖应用程序根Url都是https://MyDomain.local。
单击Create Virtual Directory不会导致错误,因为它对applicationhosts.config中的配置很满意。
注意:仅用上述设置,http://mydomain.local (端口80)就可以工作了!
此外,查看项目节点上的“属性”窗口,所有设置都如预期的那样:
SSL Enabled: True
SSL URL: https://mydomain.local
URL: http://mydomain.local另外,查看任务栏中的IIS,它们将分别显示为443和80。
Going Ninja:
这不应该是必要的(看上去http://在没有这样做的情况下是如何工作的),但是我运行netsh只是为了确保URL是注册的:
netsh http add urlacl url=https://MyDomain.local:443/ user=Everyone这当然会导致一个错误“.已经存在”。所以我跑了:
netstat -o
TCP 127.0.0.1:80 mydomain:2063 ESTABLISHED 4
TCP 127.0.0.1:2063 mydomain:http ESTABLISHED 2276
...我没看到在443港露营。不,Skype没有安装在这台机器上!(据推测是一个常见的问题)。
我完全不知所措。什么鬼东西?这不是火箭科学。
Environment:
其他信息:
我疯狂地研究过这件事。关于Stack溢出和其他地方的许多文章。这里有几个主要的几个:
和http://www.hanselman.com/blog/WorkingWithSSLAtDevelopmentTimeIsEasierWithIISExpress.aspx
我已经试过了我能看到的一切都是合乎逻辑的。对于我提出的问题,决议是设置我刚才描述的所有设置。因为这不起作用,它需要一个自己的职位!
我遗漏了什么?
发布于 2015-10-26 00:31:17
基于下面链接的博客,您需要将证书绑定到端口443。IIS已经将端口44300到44399绑定到本地证书以进行本地https开发。
我还没有试过,但是(这个博客的底部)显示了如何将现有的本地证书IISExpress用于端口44300到44399的443绑定到端口443。
https://stackoverflow.com/questions/33336370
复制相似问题