handling sub-domains in IIS for a web application

2019-09-09 12:47发布

问题:

I am have a web application on local IIS (mylocalsite.com)
What settings I need, so that I can handle all subdomains of my local site, like

user1.mylocalsite.com
user2.mylocalsite.com
anything.mylocalsite.com

All urls will point to same index page from where I can seperate subdomain and load page accordingly.

回答1:

Since your description is not that clear, my initial thought would that you can setup different Bindings in IIS to cater for all the subdomains.

In IIS 7, right click your website -> Edit Bindings -> Add..

But my guess would be that you may need to do this from code, since users are added to your system (assuming user/sub-domain model). For this I refer you to

  • Create Binding in in IIS (iis.net)
  • Cool new IIS7 Features and APIs - ScottGu
  • Microsoft.Web.Administration