Using a Domain other than localhost with IIS Express

If using IIS Express (the default for debugging web applications in Visual Studio), you can use domains other than localhost but its not particularly intuitive.

  • First, get the port number your Web application is running on (either copy it from the URL or grab it from the project settings, debug tab).
  • Navigate to %UserProfile%\Documents\IISExpress\config\ and open applicationhost.config (Full path: %UserProfile%\Documents\IISExpress\config\applicationhost.config)
  • Find the reference to the port number (49483 in my case). It might look something like this:
    
          
                
          
          
                
          
    
    
  • Now all that remains to do is add another binding to the section:
    
          
                
          
          
                
                
          
    
    

You can also set it to accept all hosts on that port by adding the following (note empty string, not wildcard *):


You will have to have set up this host to point to 127.0.0.1 in your hosts file. Or, my favourite method is to use a domain I own and point *.sub.mydomain to 127.0.0.1. Hosts file doesn’t support wildcards (*) but DNS does! This means I can easily set up projecta.sub.mydomain and projectb.sub.mydomain without having to add new lines to my hosts file (so long as I have an internet connection)!

Advertisements

One thought on “Using a Domain other than localhost with IIS Express

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s