If you have ever wondered how you could create multiple web projects in Visual Studio and then deploy those projects to a single Microsoft Azure Website, this post can show you how. Having multiple projects is a good way to separate your project into small manageable tasks that can be deployed and managed independently. Having to only pay for and manage only one website is even better!
Microsoft Azure Setup
Create and deploy your Azure Website like any other Azure Website. Once the site is deployed, there is one small configuration change you have to make. Select the Website in the Azure management console, then navigate to the Configure section.
Scroll all the way to the bottom of the section and enter the name of the virtual application and the path that it should use. By default, the “/” is the root directory and points to the “site\wwwroot” directory. Add in the custom directory that you want created, appending the name of the application after both of those values, like this example where I’ve added the “Globalization” and “Mobile” virtual applications:
Visual Studio Project Setup
Create a standard website, then set up the publish to Azure with the standard Azure Website deployment setup, with one minor exception. Manually change the deployment path in the Connection section to have the application name in the path in the Site Name and Destination URL.
Publish the application normally now, and it should get deployed as a virtual directory inside of your Azure Website.
- When the application in the root of the Azure Website is deployed, make sure that the “Delete All Files” is NOT checked, or it may remove your child application directories.
- There may be issues with the web.config file when deploying child applications. For example, if you had the following in your section in both the root application and the child application:
<add name="Glimpse" type="Glimpse.AspNet.HttpModule, Glimpse.AspNet" preCondition="integratedMode" />
This line would cause the application to fail when run as it inherited the values from the root application and then tried to add this module again.
I hope this helps you out!