I'm implementing OAuth authentication in a MVC6 site using VS2015 RC. The previous incarnation of the site required a custom binding and I'm trying to achieve the same with VS2015. Debugging with IIS Express, however, is proving difficult.
If I amend the dnx "web" command to use an alternate url, all works as expected:
"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"
},
If I try and do the same thing with IIS Express by changing the applicationhost.config file (within the project/.vs/config folder as per Wildcard hostname in IIS Express + VS 2015)...
<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>
...a new site entry is with a binding to "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>
The site is now running using the localhost binding. VS happily opens the dev url and tells me that the service is unavailable.
How can I instruct VS2015 to use the existing site and binding when debugging with IIS Express?
I used the instructions as defined here with a slight modification:
Wildcard hostname in IIS Express + VS 2015
In order to make it work I left the localhost binding and added an additional binding for *. This must be done in the ~ProjectFolder~/.vs/config/applicationhost.config and not in the old location of Documents/IISExpress.....
The corrected binding looks like this in my case: