简体   繁体   English

如何在一个Azure Web App上托管多个应用程序

[英]How to host multiple apps on one Azure Web App

i built app (ASP .NET Core MVC + Angular). 我建立了应用程序(ASP .NET Core MVC + Angular)。 I need to deploy this app for three different customers. 我需要为三个不同的客户部署此应用程序。 Each customer at this moment have its own database. 此刻每个客户都有自己的数据库。 Is it possible to have multiple sites inside one azure web app (like mysite.com/a, mysite.com/b and mysite.com/c) and each of these sites to have its own connection string ? 一个Azure Web应用程序中是否可以有多个站点(例如mysite.com/a、mysite.com/b和mysite.com/c),并且每个站点都有自己的连接字符串? Or should I go with path 1 customer - 1 web app ? 还是应该使用路径1客户-1 Web应用程序? Tnx TNX

While there might be a way to have your application deployed to the same App Service. 虽然可能有一种方法可以将您的应用程序部署到同一App Service。 It would definitely involve editing the Kudu build scripts. 肯定会涉及到编辑Kudu构建脚本。 I'm don't know much of the details there to get it working. 我不知道要使它正常工作的很多细节。

However, If you stuck with 1 App Service for each customer, you should be able to set up an environment variable in each App Service with a database connection string for each customer. 但是,如果您为每个客户坚持使用1个App Service,则应该能够在每个App Service中使用每个客户的数据库连接字符串设置环境变量。 By doing this, you could reference that environment variable in your code so you don't have to recompile with a different database connection string for each customer. 这样,您可以在代码中引用该环境变量,因此不必为每个客户使用不同的数据库连接字符串重新编译。 To create an enviroment variable in Azure App Service, go to your app in the Azure Portal. 若要在Azure App Service中创建环境变量,请在Azure门户中转到您的应用程序。 Then, select Application Settings from the side bar. 然后,从侧栏中选择“应用程序设置”。 Scroll down to App Setting Names, and you should be able to create an application setting with the database connection string for each customer in each App Service. 向下滚动到“应用程序设置名称”,您应该能够使用每个应用程序服务中每个客户的数据库连接字符串创建一个应用程序设置。

For more information on how to do that, check out this post on Stack Overflow . 有关如何执行此操作的更多信息,请查看Stack Overflow上的这篇文章。

Another option would be to create an App Service with a new slot for each customer. 另一个选择是为每个客户创建一个带有新广告位的应用服务。 They would all inherit their settings from the master App Service. 他们都将从主应用程序服务继承其设置。 In each child App Service, you would be able to set an application setting that is slotted, which would only be for that slot. 在每个子应用程序服务中,您都可以设置有槽位的应用程序设置,该设置仅适用于该槽位。 However, this is very similar to the previous option in which you create 3 separate App Services. 但是,这与您创建3个单独的App Services的前一个选项非常相似。 Here's more information on using slotted App Services. 这是有关使用插槽式App Services的更多信息 It's intended to be used as a way to create staging and production environments. 它旨在用作创建暂存和生产环境的一种方式。

I'm not sure about having multiple sites as sub-directories. 我不确定要将多个站点作为子目录。

What you can do is setup 1 Standard App Service Plan and setup multiple App Services within that plan and use subdomains to point to those App Services (CustomerA.mysite.com, CustomerB.mysite.com). 您可以做的是设置1个标准App Service计划,并在该计划中设置多个App Services,然后使用子域指向这些App Services(CustomerA.mysite.com,CustomerB.mysite.com)。 There is no additional charge for setting up multiple App Services within a single App Service Plan. 在一个应用程序服务计划中设置多个应用程序服务无需额外付费。

This has a few advantages. 这有一些优点。 You can use Azure's Application Settings Management, you can use deployment slots, and you could update each customer's production environment 1 at a time allowing you to have 1 customer Beta testing while others are running stable code. 您可以使用Azure的应用程序设置管理,可以使用部署槽,并且可以一次更新每个客户的生产环境1,从而允许您进行1个客户Beta测试,而其他人则在运行稳定的代码。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Azure Web App - 托管多个应用程序 - 访问Web API,但它显示来自Web App的web.config的错误 - Azure Web App - Multiple apps hosting - Access Web API but it shows error from web.config of Web App Azure Web 应用程序错误,未知此类主机 - Azure Web App Error, No such host is known Azure Web Apps中的调用应用程序初始化模块 - Call App Initialization module in Azure Web Apps Azure上的多个应用程序-每个服务一个应用程序还是多合一? - Multiple apps on Azure - one app-per-service or all-in-one? 如何使用Azure DevOps部署多个应用程序? - How to deploy multiple apps with Azure DevOps? 使用visual studio团队服务构建包含多个Web应用程序的解决方案,并将这些Web应用程序部署到azure - using visual studio team services to build a solution containing multiple web apps and deploy these web apps to azure 将多个网站部署到一项Azure服务 - Deploy multiple Web Site to one Azure service 如何在同一 URL 下托管多个 .NET Core 应用程序? - How to host multiple .NET Core apps under the same URL? 如何为具有多个Web应用程序的解决方案自定义“ ASP.NET CORE(完整框架)”构建定义模板,并将每个部署在Azure上 - How to customize “ASP.NET CORE (Full framework)” build definition template for a solution with multiple web apps and deploy each on Azure 一台服务器上有多个Web应用程序(Silverlight和ASP.NET MVC) - Multiple Web Apps (Silverlight and ASP.NET MVC) on One Server
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM