Multiple ASP.NET sites on same port

How to get multiple ASP.NET web sites running on a single machine using the same default port.

Say I have myfirstsite, mysecondsite

Open your hosts file as administrator (UAC will only let you do this as admin).
On the machine I’m using (Windows 7) it’s C:\windows\system32\drivers\etc\hosts
Add the following lines:

127.0.0.1 myfirstsite
127.0.0.1 mysecondsite

In IIS for both myfirstsite and mysecondsite,
you’ll need to make sure the bindings bind to all IP addresses on port 80.
The HostName will probably need to be changed to the name of your website

In IIS 7 / 7.5 To add a host header entry for a Web Site in IIS 7 / 7.5

  1.     Right click the Web Site.
  2.     Click Edit Bindings…

  1.     Click on http and click Edit…

  1.     Type the host header in the text box “Host name:” and click OK.

If you still have the great joy of working with IIS 6.0

  1.     Right click Web Site
  2.     Click on Properties.
  3.     Click Advanced… button in the Web Site tab
  4.     Click on Default and click Edit…
  5.     Type the host header in the text box “Host Header value:”

You should now be able to browse to http://myfirstsite and also http://mysecondsite using the default port 80

Advertisements

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s


%d bloggers like this: