How to use subdomains with localhost on IISExpress?

Rahul Kiwitech
Rahul K...
292 Points
26 Posts

Hi,

I am create application in vs 2015 fro multitenacy. How I can test for sub domain locally with visual studio. Means I want to create subdomains like

testsubdomain1.localhost:12454, 
testsubdomain1.localhost:12454.

Thanks

Views: 12274
Total Answered: 2
Total Marked As Answer: 0
Posted On: 28-Sep-2016 00:55

Share:   fb twitter linkedin
Answers
NiceOne Team
NiceOne...
1390 Points
18 Posts
         

This can be done by editing the applicationHost.config file and this is located at

C:\Users\yourProfile\Documents\IISExpress\config\applicationHost.config 

Or you can follow following steps to find applicationHost.config file:

I) Run VS in debug mode (in as administrator)

II) Now you can see notification area iisexpress icon as

III) Right click on this icon- click on show all applications

IV) Now you can see the links

V) Click on config link

Visual Studio usually handles editing this file for you when you make configuration changes, but you can manually edit. Check following section in file

<site name="WebSite1" id="1" serverAutoStart="true">
<application path="/">
<virtualDirectory path="/" physicalPath="%IIS_SITES_HOME%\WebSite1" />
</application>
<bindings>
<binding protocol="http" bindingInformation=":8080:localhost" />
</bindings>
</site>

Find the particular site you are working with and the following bindings should work:

<bindings>
<binding protocol="http" bindingInformation="*:12454:localhost" />
<binding protocol="http" bindingInformation="*:12454:contoso.localhost" />
</bindings>

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.

Posted On: 28-Sep-2016 01:44
Rahul Maurya
Rahul M...
4918 Points
28 Posts
         
 Log In to Chat