Azure Web App - 多个应用托管 [英] Azure Web App - Multiple apps hosting
问题描述
在我的本地 IIS 服务器中,我创建了一个 IIS 网站并部署了 3 个 ASP.NET Web 应用程序,以便它们具有类似的 URLIIS URL/webapp1 , IIS URL/webapp2 , IIS URL/webapp3 ,它就像魅力一样工作.我只能在 Azure webapp 中部署一个 Web 应用程序,而不能在其他应用程序中部署.
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.
我可以在一个 Azure Web 应用程序中部署多个 Web 应用程序吗?如果是,那么如何?
Can i deploy more than one web application in one Azure web app ? If yes, then how ?
推荐答案
我的解决方案描述如下.首先创建一个示例 AzureWebsite -
My solution is described below. First create a sample AzureWebsite -
在 Azure 网站中设置一个附加应用程序,如下所示.导航到 Configuration 选项卡
并创建一个应用程序,如下所示 -
Setup up an additional application in the AzureWebsite as follows. Navigate to Configuration tab
and create an application as shown below –
通过创建上述应用程序,我们将 /
保留给 MVC 站点,然后将 /webapi
保留给 webapi 端点.
By creating above application we reserved /
to MVC site and then /webapi
to webapi endpoints.
假设您想从 VS 解决方案发布 MVC 和 Web API 项目,如下所示.
Lets say you want to publish MVC and Web API projects from VS Solution as shown below.
下载上面创建的 Azure 网站的 publishsettings 文件.将publishsettings文件导入Visual Studio MVC项目(右键项目,选择发布)如下图-
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 -
通过导入相同的 publishsettings 文件类似地发布 WebApi 项目.但是我们需要将 Destination URL
和 Site name
更改为新创建的应用程序详细信息.请检查下面的屏幕截图-
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 –
发布这两个项目.
现在导航到 MVC 站点的 http://ramidev1.azurewebsites.net.对于 WebApi 端点,导航到 http://ramidev1.azurewebsites.net/webapi/api.
Now navigate to http://ramidev1.azurewebsites.net for the MVC site. And navigate to http://ramidev1.azurewebsites.net/webapi/api for WebApi endpoints.
这篇关于Azure Web App - 多个应用托管的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!