Search code examples
iisweb-applicationsbinddomain-name

How to bind thousands of domain names to one web application?


The idea is to allow people to assign their own domain name to a profile on my web site,

One thing I could do is to bind each domain name to the web app in IIS, but this will be ugly as I may have many domains in that list, also I wonder if this can impact the performance for that web application if I had so many domains associated with one web app,

Also, I like to make these changes programmatically instead of adding it manually (like when binding a domain name to a web app in IIS)

Any ideas how to approach this?


Solution

  • U can try the below power shell script for that. Make a csv file(name : Site.csv) having your domains in a column(Header name: name) and keep it in C Colon.

        $csv = import-csv C:\site.csv
        foreach($line in $csv)
        {
        $name = $line.name
        New-WebBinding -Name "Default Web Site" -IPAddress "*" -Port 80 -HostHeader $name
        }