问题
In my local IIS server, i have created a IIS website and deployed 3 ASP.NET web application such that they will have URL like IIS URL/webapp1 , IIS URL/webapp2 , IIS URL/webapp3 and it works like charm. I am able to deploy only one web application in Azure webapp and not others.
Can i deploy more than one web application in one Azure web app ? If yes, then how ?
回答1:
My solution is described below. First create a sample AzureWebsite -
Setup up an additional application in the AzureWebsite as follows. Navigate to Configuration tab
and create an application as shown below –
By creating above application we reserved /
to MVC site and then /webapi
to webapi endpoints.
Lets say you want to publish MVC and Web API projects from VS Solution as shown below.
Download publishsettings file of above created AzureWebsite. Import the publishsettings file to the Visual studio MVC project (right click the project and select publish) as shown below -
Similarly publish the WebApi project by importing the same publishsettings file. But we need to change the Destination URL
and Site name
to the newly created application details. Please check below screenshot –
Publish both the projects.
Now navigate to http://ramidev1.azurewebsites.net for the MVC site. And navigate to http://ramidev1.azurewebsites.net/webapi/api for WebApi endpoints.
回答2:
Yes, you can do that with virtual directory.
Quote from Add virtual directory to existing website on Azure
Virtual Directories are supported for Azure Websites. See Configuring Azure Websites for what you can do through the Azure Management Portal. From the Azure Portal, click on the Website and go to Configure, then scroll down to virtual applications and directories (the last config section). Just enter your virtual directory and the physical path relative to the site root and click Save.
来源:https://stackoverflow.com/questions/34688681/azure-web-app-multiple-apps-hosting