The Azure Code Samples are currently available in English
Host multiple websites within one Azure webrole using Visual Studio 2015
This example shows how to host multiple websites within one Azure webrole using Visual Studio 2015. This is a supplement and implement for Azure official video: Multiple Websites in a Web Role. Since that post is dated to 2011, updates for the past years could bring about a better approach. This post will give you the latest version of implementation.
2. Visual Studio 2015
3. ASP.NET MVC 5
The tutorial assumes that you have worked with ASP.NET MVC and Visual Studio. If you need an introduction, see Getting Started with ASP.NET MVC 5.
4. Azure SDK
The tutorial is written for Visual Studio 2015 with the Azure SDK for .NET 2.9 or later. Download the latest Azure SDK for Visual Studio 2015. The SDK installs Visual Studio 2015 if you don't have it.
Run the sample
- Please first download my test VS solution MultipleWebSite.zip for your reference.
- After downloading, please unzip it and open the main “MultiWebsitesOneWebRole” solution as Administrator.
Switch to ServiceDefinition.csdef file, replace the physicalDirectory in Site section according to your configuration.
- Add below info to your host file
127.0.0.1 www.firstsite.com 127.0.0.1 www.secondsite.com 127.0.0.1 www.thirdsite.com
- Open command console and ping to check if the dns name can be used.
- Run the solution, and visit three websites in your web browser.
Below are some useful links, you will need them before your real action.
[Some notes that you might need to know when you start to deploy your websites]
How to setting up CNAMEs for your domain:
Tips for Publishing Multiple Sites in a Web Role:
How to configure the Azure Cloud Service Project to compile all the associated webs within a single web role: