Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at
Multiple sites and host headers on localhost with IIS7

One of the limitations of the IIS6 on Windows XP is that IIS is limited to only one site, so I had to use virtual directories for every site I was working on. Unfortunately I had one project that has to be placed directly in the site, not in a virtual directory. That situation made some configuration issues for sites located in virtual directories due to inheritance settings from root web.config. It was nothing really serious, just small pain in the ass.

Recently I've switched to Vista and one of the first things I made was to see the new IIS7 and I've realised that with IIS7 I can set up multiple sites. That was great news indeed. Now I'm able to use separated sites for every project I have and I don't have to bother with virtual directories anymore.

First of all we have to create new site using IIS Manager. That's pretty simple and similar to IIS6. Right click on the "Web Sites" and then "Add Web Site" from the context menu.

In the "Add Web Site" dialog we have to fill all necessary fields and specify the host name we want to use.

After new site is created is ... not working, nothing happen when we will open http://mysite in browser. To fix that we have to find a file "hosts" located in C:\Windows\System32\drivers\etc\ and then edit this file in the Notepad (or whatever you are using. Only what needs to be done here is a new line as on the screen below.

Now we can browse the new site and we can set up this site in project properties using Custom Server option.

Hope that helps.

Posted 03-01-2007 2:01 PM by Jimmy
Filed under: , ,


About The CodeBetter.Com Blog Network
CodeBetter.Com FAQ

Our Mission

Advertisers should contact Brendan

Google Reader or Homepage Latest Items
Add to My Yahoo!
Subscribe with Bloglines
Subscribe in NewsGator Online
Subscribe with myFeedster
Add to My AOL
Furl Latest Items
Subscribe in Rojo

Member Projects
DimeCasts.Net - Derik Whittaker

Friends of
Red-Gate Tools For SQL and .NET


SmartInspect .NET Logging
NGEDIT: ViEmu and Codekana
NHibernate Profiler
Balsamiq Mockups
JetBrains - ReSharper
Web Sequence Diagrams
Ducksboard<-- NEW Friend!


Site Copyright © 2007 CodeBetter.Com
Content Copyright Individual Bloggers


Community Server (Commercial Edition)