Shimmy Weitzhandler
Shimmy Weitzhandler

Reputation: 104741

Local debugging of subdomains with VS 2015

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:

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:

It looks like I can add the asterisk in those places but it doesn't actually work.

Upvotes: 6

Views: 2515

Answers (1)

Dealdiane
Dealdiane

Reputation: 4064

I'm guessing you're using IIS express locally?

If so, in your solution directory, there is a .vs folder. You need to add the binding in the \config\applicationhost.config file inside that folder. Then make sure that you've allowed IIS express to listen to that subdomain.

You can refer to Scott's article on how to configure IIS Express. Specifically look for this paragraph "1. GETTING IIS EXPRESS TO SERVE EXTERNALLY OVER PORT 80"

To be more specific, you need to run these commands:

netsh http add urlacl url=http://{your-domain}:{custom-port}/ user=everyone

netsh firewall add portopening TCP {custom-port} IISExpressWeb enable ALL

Upvotes: 6

Related Questions