Host Multiple Application In a Single Azure App Service

In this blog, we will learn about hosting multiple applications in a single Azure App Service.

Introduction

 
Sometimes it becomes necessary to run multiple applications in a single application server. In this post, we will show how to host multiple applications in a single Azure Web App. 
 

How?

 
The folder structure of an Azure App service is like / (root) -> Site -> wwwroot. The actual application resides on the wwwroot folder and we publish on that folder. 
 
image1
 
The idea is to create new folders according to your requirement and make that an application like IIS. So, let’s say we have a car website and we have to show the interior and exterior of the car with two different applications.
 
Create two different folders in the wwwroot folder using Filezilla. We are using Filezilla here for the example, you can directly publish to the folder from Visual Studio publish profile.
 
Connect your web app and create two new folders named “exterior” & “interior”. After creating the folder structure it will be something like this.
 
image2
 
Now go to your Azure portal (https://portal.azure.com). Go to the web app and search for “Configuration” in the left side search box of the web app. It will be under the “Settings” section.
 
image3
 
Click on the “Configuration” and go to “Path mapping”.
 
image4
 
In the path mapping blade, you will find the “Virtual application and directories” tab.
 
Add your folders over there and uncheck the “Directory” checkbox if you want to add this as an application, with your physical path.
 
Please note the physical path should start from the root folder.
 
image5
 
After adding the applications, you will find those in the following table under “Virtual applications and directories”. Click on the “Save” button to save the application.
 
image6
 
Now upload the content/application on the specific folders either via FileZilla or Visual Studio publishing profile.
 
And now it’s time for testing. Open the browser and type out the web app URL with the virtual pathname.
 
http://<your web app url>/<virtual directory name>
 
E.g.: https://abc.azurewebsites.net/exterior & http://abc.azurewebsites.net/interior
 
image7
 
Now using this technique, you can host as many applications as you want.
 

Summary

 
In this article, we learned about hosting multiple applications in a single Azure App Service.