Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure IIS 7.5 to run multiple websites on localhost

I have got two website which runs on for instance http://localhost:3452 & http://localhost:5234

When I press F5 in VS2010, I am wondering if I can set both the website on IIS so that I can just type something like http://Website1 and http://Website2 to play with both the website, instead of debugging everytime?

Is there a way to acheive this?

I tried to add a website on IIS with no success by following simple steps :

  1. RightClick on Sites > Add Website,
  2. Sitename: Website1 , ApplicationPool: DefaultApp pool , PhysicalPath: Path to the Website, Press ok.
  3. Now in the browser I tried something like: http://Website1 which comes up with the error below.

Any suggestions or alternatives on how to achieve this?

HTTP Error 500.19 - Internal Server Error The requested page cannot be accessed because the related configuration data for the page is invalid. This error occurs when there is a problem reading the configuration file for the Web server or Web application. In some cases, the event logs may contain more information about what caused this error.

like image 1000
Mr A Avatar asked Feb 24 '23 07:02

Mr A


1 Answers

open c:\windows\system32\drivers\etc\hosts and add the following

127.0.0.1  website1
127.0.0.1  website2

UAC may block you so you'll need to open notepad as administrator to edit the file.

In IIS change the bindings on the website so it binds to all ip addresses on port 80 but with the host header set to website1. do the same for website2.

Now you can browse to either http://website1 or http://website2

This will only work on your machine of course

like image 135
Simon Halsey Avatar answered Mar 03 '23 13:03

Simon Halsey