When I originally began to dig into Azure, multiple sites per role wasn’t supported. And quite frankly was very important to take down costs for people like me who host lots of little development projects. Fortunately version 1.3 of Azure introduced full flavour IIS 7.5 which mean you can do this. This is great if you have a few websites which don’t really need their own instance each but you want them up there. Hopefully this will allow Azure to take off more, allowing developers and smaller sites to host easily and cheaply on the platform.
How to do it:
Use the following in your ServiceDefinition.csdef file:
<Sites> <Site name="OwenBlog" physicalDirectory="..SampleWebApp"> <Bindings> <Binding name="HttpIn" endpointName="HttpIn" hostHeader="www.owenadavies.co.uk" /> </Bindings> </Site> <Site name="OwenTest" physicalDirectory="c:SampleWebApp"> <VirtualApplication name="testapp" physicalDirectory="c:testapp" /> <Bindings> <Binding name="HttpIn" endpointName="HttpIn" hostHeader="www.testsite.com" /> </Bindings> </Site> </Sites>
You would then set up each of your 2 domains to map to your Azure domain url (http://YOURAPPNAME.cloudapp.net) via a CNAME, and azure will use the hostHeader to figure out which site to server. This is exactly the same mechanism as what is done in IIS if you ran on premises.