Today, when I try to visit a website defined in IIS Express, it returned "Unable to connect" error in the browser.
But, I had everything configured correctly
1) hosts file entry was added
127.0.0.1 sc81.local
2) site is defined in applicationhost.config
<site name="sc81.local" id="3" serverAutoStart="true">
<application path="/">
<virtualDirectory path="/" physicalPath="D:\Sitecore\Prototype\sc81.local\Website" />
</application>
<bindings>
<binding protocol="http" bindingInformation=":8070:sc81.local" />
</bindings>
</site>
And this is how my <sites> section in the applicationhost.config looks like
<sites>
<site name="sc70.local" id="1" serverAutoStart="true">
<application path="/">
<virtualDirectory path="/" physicalPath="D:\Sitecore\Prototype\sc70.local\Website" />
</application>
<bindings>
<binding protocol="http" bindingInformation=":8080:sc70.local" />
</bindings>
</site>
<site name="sc81.local" id="3" serverAutoStart="true">
<application path="/">
<virtualDirectory path="/" physicalPath="D:\Sitecore\Prototype\sc81.local\Website" />
</application>
<bindings>
<binding protocol="http" bindingInformation=":8070:sc81.local" />
</bindings>
</site>
....
<applicationDefaults applicationPool="Clr4IntegratedAppPool" />
<virtualDirectoryDefaults allowSubDirConfig="true" />
</sites>
After few minutes of struggle, I decide to search this issue on internet. And, I found the answer. :-)
http://stackoverflow.com/questions/7142792/iis-express-7-5-only-loading-one-site-even-though-2-sites-defined
The reason for this is, I just ran the "iisexpress.exe" without "/apppool " parameter.
So, when we just run the "iisexpress.exe", IIS Express will only start the first define site that they can find in the applicationhost.config file.
So, solution for this issue is run the command as follows
iisexpress.exe /apppool:Clr4IntegratedAppPool
You might think, how this is working, since you I don't have specifically define the "applicationPool" setting in anywhere in the configs.
But, if you take a look at the above applicationhost.config file, you see following line, and there we have given the default applicationPool setting.
<applicationDefaults
applicationPool="Clr4IntegratedAppPool" />
You can also define applicationPool setting in site definition level also as follows
<sites>
<site name="sc70.local" id="1" serverAutoStart="true">
<application path="/" applicationPool="customAppPool">
<virtualDirectory path="/" physicalPath="D:\Sitecore\Prototype\sc70.local\Website" />
</application>
<bindings>
<binding protocol="http" bindingInformation=":8080:sc70.local" />
</bindings>
</site>
...