我正在使用 VS2015 RC 在 MVC6 站点中实现 OAuth 身份验证。该站点的前一个化身需要自定义绑定(bind),我正在尝试使用 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 文件(根据 Wildcard hostname in IIS Express + VS 2015 在 project/.vs/config 文件夹中)对 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>
...一个新的站点条目绑定(bind)到“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 绑定(bind)运行。 VS 愉快的打开 dev url 告诉我服务不可用。
使用 IIS Express 进行调试时,如何指示 VS2015 使用现有站点和绑定(bind)?
最佳答案
我使用了此处定义的说明并稍作修改:
Wildcard hostname in IIS Express + VS 2015
为了使它工作,我离开了 localhost 绑定(bind)并为 *.这必须在 ~ProjectFolder~/.vs/config/applicationhost.config 中完成,而不是在 Documents/IISExpress 的旧位置......
在我的情况下,更正的绑定(bind)看起来像这样:
<bindings>
<binding protocol="http" bindingInformation="*:4355:localhost" />
<binding protocol="http" bindingInformation="*:4355:*" />
</bindings>
关于iis-express - 使用 VS2015 和 IIS Express 覆盖站点绑定(bind),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30820756/