Enabling Subdomains on IISExpress (localhost) for test multitenancy
Introduction
As a developer some time we need to create sub-domains with IIS Express in local machine for testing. In order to test it on a development machine, a couple of small additions needs to be done to allow subdomains with localhost (e.g. tenant1.localhost) together with IIS Express. This article helpfull for configuring such environment.
Description
Follow the following easy steps
I) Open Visual Studio in Run As Administrator
II) Open Project in which you want to test multitenancy
II) Find applicationHost.config file and edit it as:
a) Run Project in Debug mode
b) Now you can see in notification area iisexpress icon as
c) Right click on this icon- click on show all applications
d) Now you can see the links
e) Click on config link. This is the applicationHost.config file
III) Visual Studio usually handles editing this file for you when you make configuration changes, but you can manually edit. Check following section in file
Find the particular site you are working with and add following bindings should work:
You can really change the port to anything you want so you could use 80 to save yourself some typing. Continue adding bindings to fill out your multi-tenancy as needed.
IV) Now Stop Debug and Start again
Note: Visual Studio should be run as Administrator
Conclusion
In above example we learn how to use sub-domains in localhost. I hope it will helpful for develper who want to configure sub-domains for testing multitenancy.
Rahul Kiwitech
20-Oct-2016 at 02:22