微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

iis-express – 使用VS2015和IIS Express覆盖站点绑定

我正在使用VS2015 RC在MVC6站点中实现OAuth身份验证.该网站的先前版本需要自定义绑定,我正在努力实现与VS2015相同.但是,使用IIS Express进行调试很困难.

如果我修改dnx“web”命令以使用备用URL,则所有命令都按预期工作:

"commands": {
    "web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://www.devurl.co.uk:31122","gen": "Microsoft.Framework.CodeGeneration","ef":  "EntityFramework.Commands"
},

如果我尝试通过更改applicationhost.config文件(在项目/ .vs / config文件夹中按照Wildcard hostname in IIS Express + VS 2015)对IIS Express执行相同的操作…

<sites>
    <site name="WebApp1" id="1">
        <!-- removed for brevity -->
        <bindings>
            <binding protocol="http" bindinginformation="*:31122:www.devurl.co.uk" />
        </bindings>
    </site>
        <!-- removed for brevity -->
</sites>

一个新的站点条目绑定到“localhost”.

<sites>
    <site name="WebApp1" id="1">
        <!-- removed for brevity -->
        <bindings>
            <binding protocol="http" bindinginformation="*:31122:www.devurl.co.uk" />
        </bindings>
    </site>
    <site name="WebApp1(1)" id="2">
        <!-- removed for brevity -->
        <bindings>
            <binding protocol="http" bindinginformation="*:31122:localhost" />
        </bindings>
    </site>
    <!-- removed for brevity -->
</sites>

站点现在使用localhost绑定运行. VS愉快地打开dev url并告诉我该服务不可用.

在使用IIS Express进行调试时,如何指示VS2015使用现有站点和绑定?

解决方法

我使用了这里定义的说明稍作修改

Wildcard hostname in IIS Express + VS 2015

为了使它工作,我离开了localhost绑定并为*添加一个额外的绑定.这必须在~ProjectFolder~ / .vs / config / applicationhost.config中完成,而不是在Documents / IISExpress的旧位置…..

在我的情况下,更正的绑定看起来像这样:

<bindings>
  <binding protocol="http" bindinginformation="*:4355:localhost" />
  <binding protocol="http" bindinginformation="*:4355:*" />
</bindings>

原文地址:https://www.jb51.cc/c/118769.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐