Configure the Site Entry in the Service Definition File
Updated: March 6, 2014
You use the Site element to specify a web site or web application that is hosted in Internet Information Services (IIS) 7.0. The Site element is a child of the Sites entry in the ServiceDefinition.csdef file. If you are upgrading an existing web application to the new schema, you need to add the Sites node. This allows your application to take advantage of the full IIS feature set.
|The Site element, which allows a web role to run in full IIS mode, is required in Windows Azure SDK versions 2.0 and later. Hosted Web Core (HWC) is not supported in SDK versions 2.0 and later.|
For additional information about how IIS manages sites, see Configure a Web Server to Serve Content (IIS 7.0).
Open the ServiceDefinition.csdef file. Locate the Sites element, and then add Site element inside the Sites node as follows:
<Site name="<name of the site>" physicalDirectory=”<path to the site content>”></Site>
Within the Site node, add a Bindings element as follows:
<Bindings> <Binding name="<name of the binding>" endpointName="<name of the endpoint to bind to>” hostHeader=”<the URL of the web site>”/> </Bindings>
The following sample XML code shows a configuration for a site called Web, which is located in the SampleWebApp directory.
<WebRole name=”SampleWebApp”> <Sites> <Site name="Web" physicalDirectory=”..\SampleWebApp”> <Bindings> <Binding name="HttpIn" endpointName="HttpIn" hostHeader=”www.sampleapp.com”/> </Bindings> </Site> </Sites> <InputEndpoints> <InputEndpoint name="HttpIn" protocol=”http” port=”80” /> </InputEndpoints> …