Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple sites in Azure web app

My Azure web app (example.azurewebsites.net) has one custom domain, applicationhost.config:

<sites>
  <site name="example" id="111111111">
    <bindings>
      <binding protocol="http" bindingInformation="*:80:customdomain.com" />
      <binding protocol="https" bindingInformation="*:443:customdomain.com" />
      <binding protocol="http" bindingInformation="*:80:example.azurewebsites.net" />
      <binding protocol="https" bindingInformation="*:443:example.azurewebsites.net" />
    </bindings>
    <application path="/" applicationPool="example" preloadEnabled="true">
      <virtualDirectory path="/" physicalPath="D:\home\site\wwwroot" />
      <virtualDirectory path="/iisnodedebugger" physicalPath="C:\DWASFiles\Sites\example\Temp\iisnode" />
    </application>
    <traceFailedRequestsLogging enabled="false" customActionsEnabled="true" directory="D:\home\LogFiles" />
    <detailedErrorLogging enabled="true" directory="D:\home\LogFiles\DetailedErrors" />
    <logFile logSiteId="false" />
  </site>
  ...
</sites>

The custom domain's bindigs are automatically added to the default site (example).

I would like to change it, i would like to create a new site with bindings to the custom domain (customdomain.com).

applicationHost.xdt (created with IIS Manager):

<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  <system.applicationHost>
    <sites>
      <site name="example" xdt:Locator="Match(name)">
        <bindings>
          <binding bindingInformation="*:443:customdomain.com" xdt:Locator="Match(bindingInformation)" xdt:Transform="Remove" />
          <binding bindingInformation="*:80:customdomain.com" xdt:Locator="Match(bindingInformation)" xdt:Transform="Remove" />
        </bindings>
      </site>
      <site name="customdomain" id="222222222" xdt:Transform="InsertAfter(/configuration/system.applicationHost/sites/site[(@name='example')])">
        <bindings>
          <binding protocol="http" bindingInformation="*:80:customdomain.com" />
          <binding protocol="https" bindingInformation="*:443:customdomain.com" />
        </bindings>
        <application path="/" applicationPool="example" preloadEnabled="true">
          <virtualDirectory path="/" physicalPath="D:\home\site\wwwroot2" />
          <virtualDirectory path="/iisnodedebugger" physicalPath="C:\DWASFiles\Sites\example\Temp\iisnode" />
        </application>
      </site>
    </sites>
  </system.applicationHost>
</configuration>

After restart the transform is successfull.

The problem: it has no effect. The customdomain.com is still served from "D:\home\site\wwwroot" and not "D:\home\site\wwwroot2".

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.

Where am I mistaken? Isn't it possible to manipulate the sites section?

like image 223
user2939345 Avatar asked Nov 06 '16 23:11

user2939345


People also ask

What is multi site in Application Gateway?

Multiple site hosting enables you to configure more than one web application on the same port of application gateways using public-facing listeners. It allows you to configure a more efficient topology for your deployments by adding up to 100+ websites to one application gateway.

How do I make a website on Azure Web App?

Create a Website in Azure Management PortalStep 1 − Login to your management portal. Step 2 − Click 'New' at the left bottom corner of the screen → Compute → Web Apps → Quick Create. Step 3 − Enter the details as shown in the picture above and click 'Create Web App'.

Can you host a website in Azure?

Azure App Service enables you to build and host web applications in the programming language of your choice without managing infrastructure. Learn how to create a website through the hosted web app platform in Azure App Service.

How many apps are in App service plan?

You can host up to 100 apps in a single app service plan, but the key thing to know here is that as with the free plan you are charged per app, not per app service plan. Each instance of a web app you deploy in the shared plan get's it's own 240 CPU minutes limit and is charged per app.


1 Answers

May i ask why are you trying to make your life hard?

Why don't you deploy your 2nd application to a new Web App? You can share the same App Service Plan (same VM) if cost is the essence here.

Every Web App has its own custom domain settings which you can configure visually through the Portal:

https://azure.microsoft.com/en-gb/documentation/articles/web-sites-custom-domain-name/

Custom-Domain-UI

like image 127
evilSnobu Avatar answered Oct 11 '22 15:10

evilSnobu