【问题标题】:Override site binding using VS2015 and IIS Express使用 VS2015 和 IIS Express 覆盖站点绑定
【发布时间】:2015-08-29 12:11:03
【问题描述】:

我正在使用 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 文件(在 project/.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 使用现有站点和绑定?

【问题讨论】:

  • 我偶然发现了同样的问题。运气好吗?

标签: iis-express asp.net-core visual-studio-2015 asp.net-core-mvc


【解决方案1】:

我使用此处定义的说明稍作修改:

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>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-09-15
    • 1970-01-01
    • 2012-10-02
    • 2011-07-26
    • 2018-12-13
    • 2010-09-18
    • 1970-01-01
    相关资源
    最近更新 更多