I have a multi-tenant application that is accessed in production as customer.ourdomain.com
. For local development with IIS, we use a custom wildcard domain, company-localdev.com
.
With IIS, this works without any particular configuration. IIS Express, on the other hand, only binds to localhost
.
We have an ongoing migration project to ASP.NET 5, and we'd like to use IIS Express for an easier developer experience.
Is it possible to have IIS Express listen to *.company-localdev.com:1234
? Bonus points if this can be automated so a developer can have it working just by opening the solution in IIS.
In ASP.NET 5 / vNext, the config file is found in
From there, you can add new bindings like rdans explained.
Ok I got it working on my local machine, here are all the steps I had to take:
Go to
{YourProjectFolder}\.vs\config
and edit the applicationhost.config file:Run Notepad as Administrator and go to
C:\Windows\System32\drivers\etc
to open the hosts file and amend it like so127.0.0.1 example.com
127.0.0.1 sub1.example.com
127.0.0.1 sub2.example.com
Add the url reservation by running cmd.exe as Administrator and typing in the netsh http prompt (to get the
netsh http>
prompt, you must typenetsh
followed by Enter, thenhttp
followed byEnter
):add urlacl url=http://example.com:80/ user=everyone
add urlacl url=http://sub1.example.com:80/ user=everyone
add urlacl url=http://sub2.example.com:80/ user=everyone
Bear in mind that the keyword
everyone
depends on the language of your Windows OS. On a French OS,user=everyone
shall be replaced byuser="Tout le monde"
, on a German OS it should beuser=jeder
, in Spanishuser=todos
etc... you get the idea.Hope this helps.
Havent tried it with vs2015 but this works with iis express in vs 2012.
go to your documents folder. Open up IISExpress/config.applicationhost.config.
search for the 'sites' xml tag and find your site. You can modify your site bindings from here like so:
Debugging only works for me if I run visual studio as an administrator.