I have a multi-tenant website that has to take care of any incoming request and determine the appropriate routing by the URL subdomain.
I set up the subdomain routing using this or a similar solution.
However I'm trying to access my website on my local machine using subdomains an alias website. I'm unable to get my local IIS to port to my website with the subdomain I've specified.
I want to dedicate a virtual domain name in my local machine that will port to the website I'm debugging on VS (localhost:23456
).
I've read some answers of identical questions (like this or this one), but it looks like the system has changed with the new IIS and Visual Studio 2015 and ASP.NET 5 MVC 6 (vNext) project configuration.
Here's what I've tried according to the answers linked above:
- I tried setting the
hosts
file portingwww.myexample.com
to127.0.0.1
but I get a "Bad request" error when navigating towww.myexample.com:23456
in my browser, and anyway the debugger doesn't report a request. - I tried setting
<binding protocol="http" bindingInformation=":23456:www.myexample.com" />
in the applicationhost.config file, gets IIS to raise an error saying "Replace hostname with localhost. Any otherbindingInformation
not specificyinglocalhost
as the website raises that IIS error.
Update
After opiants answer
I knew about the .vs folder and that's were I was configuring the bindings indeed.
However, looks like it was the permission that caused IIS to throw errors.
Running that netsh
command solved the issue. And BTW, since I'm only running it my own machine, I'm not gonna need to open the firewall.
Anyway my question is if there is a way to add a wildcard instead of each subdomain separately? Since each tenant gets a unique subdomain, the whole process of adding subdomains is going to be dynamic by nature. I need to allow an asterisk in all the 3 places:
- hosts file
- applicationhost.config file
- netsh command
It looks like I can add the asterisk in those places but it doesn't actually work.