title: Multiple sites in Azure web app
body: <p>My Azure web app (example.azurewebsites.net) has one custom domain, applicationhost.config:</p>
  
  <pre><code>&lt;sites&gt;
    &lt;site name="example" id="111111111"&gt;
      &lt;bindings&gt;
        &lt;binding protocol="http" bindingInformation="*:80:customdomain.com" /&gt;
        &lt;binding protocol="https" bindingInformation="*:443:customdomain.com" /&gt;
        &lt;binding protocol="http" bindingInformation="*:80:example.azurewebsites.net" /&gt;
        &lt;binding protocol="https" bindingInformation="*:443:example.azurewebsites.net" /&gt;
      &lt;/bindings&gt;
      &lt;application path="/" applicationPool="example" preloadEnabled="true"&gt;
        &lt;virtualDirectory path="/" physicalPath="D:\home\site\wwwroot" /&gt;
        &lt;virtualDirectory path="/iisnodedebugger" physicalPath="C:\DWASFiles\Sites\example\Temp\iisnode" /&gt;
      &lt;/application&gt;
      &lt;traceFailedRequestsLogging enabled="false" customActionsEnabled="true" directory="D:\home\LogFiles" /&gt;
      &lt;detailedErrorLogging enabled="true" directory="D:\home\LogFiles\DetailedErrors" /&gt;
      &lt;logFile logSiteId="false" /&gt;
    &lt;/site&gt;
    ...
  &lt;/sites&gt;
  </code></pre>
  
  <p>The custom domain's bindigs are automatically added to the default site (example).</p>
  
  <p>I would like to change it, i would like to create a new site with bindings to the custom domain (customdomain.com).</p>
  
  <p>applicationHost.xdt (created with IIS Manager):</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"&gt;
    &lt;system.applicationHost&gt;
      &lt;sites&gt;
        &lt;site name="example" xdt:Locator="Match(name)"&gt;
          &lt;bindings&gt;
            &lt;binding bindingInformation="*:443:customdomain.com" xdt:Locator="Match(bindingInformation)" xdt:Transform="Remove" /&gt;
            &lt;binding bindingInformation="*:80:customdomain.com" xdt:Locator="Match(bindingInformation)" xdt:Transform="Remove" /&gt;
          &lt;/bindings&gt;
        &lt;/site&gt;
        &lt;site name="customdomain" id="222222222" xdt:Transform="InsertAfter(/configuration/system.applicationHost/sites/site[(@name='example')])"&gt;
          &lt;bindings&gt;
            &lt;binding protocol="http" bindingInformation="*:80:customdomain.com" /&gt;
            &lt;binding protocol="https" bindingInformation="*:443:customdomain.com" /&gt;
          &lt;/bindings&gt;
          &lt;application path="/" applicationPool="example" preloadEnabled="true"&gt;
            &lt;virtualDirectory path="/" physicalPath="D:\home\site\wwwroot2" /&gt;
            &lt;virtualDirectory path="/iisnodedebugger" physicalPath="C:\DWASFiles\Sites\example\Temp\iisnode" /&gt;
          &lt;/application&gt;
        &lt;/site&gt;
      &lt;/sites&gt;
    &lt;/system.applicationHost&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>After restart the transform is successfull.</p>
  
  <p>The problem: it has no effect. The customdomain.com is still served from "D:\home\site\wwwroot" and not "D:\home\site\wwwroot2".</p>
  
  <p>After that i deleted only the bindigs without adding the new site, customdomain still working... After that i deleted the whole site (example), example.azurewebsites.net and customdomain.com still working.</p>
  
  <p>Where am I mistaken? Isn't it possible to manipulate the sites section?</p>