简体   繁体   English

Azure Web 应用部署槽 web.config

[英]Azure Web App deployment slots web.config

I have an application deployed hosted as Azure Web apps and I want to create multiple environments for it: staging, QA, Live using deployment slots.我有一个部署为 Azure Web 应用程序托管的应用程序,我想为它创建多个环境:暂存、QA、使用部署槽的实时。

I keep all of the apps configurations in web.config and I would like to keep them there.我将所有应用程序配置保存在 web.config 中,我希望将它们保存在那里。 I know that web apps have a configuration section, but I would like to use web.config.我知道网络应用程序有一个配置部分,但我想使用 web.config。

My question is: when swapping between slots, is there a way of ignoring the web.config file so that each slot (environment) keeps it's own configuration file?我的问题是:在插槽之间交换时,有没有办法忽略 web.config 文件,以便每个插槽(环境)保留自己的配置文件?

Thanks谢谢

There is no way to ignore web.config during swap.在交换期间无法忽略 web.config。 When you swap, all files get swapped.交换时,所有文件都会交换。

The mechanism to solve this is to use slot settings as described in the doc .解决这个问题的机制是使用文档中描述的槽设置。 That can be used to set the value of App Settings and Connection Strings in a way that overrides what you have in your web.config, and making it a slot setting means it does not get swapped.这可用于以覆盖 web.config 中的内容的方式设置 App Settings 和 Connection Strings 的值,并使其成为插槽设置意味着它不会被交换。

Short answer no, you would have to replace the web.config in the QA environment with the Live web.config before swapping.简短的回答不,您必须在交换之前将 QA 环境中的 web.config 替换为 Live web.config。

What you probably want to use are the Azure 'Application settings'.您可能想要使用的是 Azure 的“应用程序设置”。 An azure application setting overrides a web.config value and can also be configured to stick to that specific deployment slot. azure 应用程序设置会覆盖 web.config 值,也可以配置为坚持该特定部署槽。

Determine what AppSettings and ConnectionStrings settings in the web.config are specific to the environment, for each environment configure those in the Azure Configuration area and mark them as 'Deployment slot settings'.确定 web.config 中哪些 AppSettings 和 ConnectionStrings 设置特定于环境,为每个环境在 Azure 配置区域配置这些设置并将它们标记为“部署槽设置”。

For example let's say I had deployment slots for a QA and live environment called QA-Slot and Live-Slot.例如,假设我有一个用于 QA 和实时环境的部署槽,称为 QA-Slot 和 Live-Slot。

In my example I have a specific connection string to the QA database and to the Live database called 'defaultConnection' and let's say for each one of these I have a webApp setting that points to a 'Live' APIUrl and a 'QA' APIUrl.在我的示例中,我有一个到 QA 数据库和名为“defaultConnection”的 Live 数据库的特定连接字符串,假设对于其中的每一个,我都有一个指向“Live”APIUrl 和“QA”APIUrl 的 webApp 设置。

To set up the connection strings and appSettings using the Azure interface, navigate to your Web App's dashboard, in the vertical navigation on the left, select 'Configuration' under the 'Settings' section and then select 'Application settings' in the horizontal tab.要使用 Azure 界面设置连接字符串和 appSettings,请导航到 Web 应用的仪表板,在左侧的垂直导航中,选择“设置”部分下的“配置”,然后在水平选项卡中选择“应用程序设置”。

Set up your appSettings and connection string appropriately and on the Add/Edit dialog there is a checkbox to designate them as a 'Deployment slot setting' that you would check.适当地设置您的 appSettings 和连接字符串,在“添加/编辑”对话框中,有一个复选框将它们指定为您要检查的“部署槽设置”。

After configuring your settings for the Live and QA environment any deployment in Live-Slot points to the 'Live' database and 'Live' APIUrl and any deployment in the QA-Slot points to the QA database and QA APIUrl.在为 Live 和 QA 环境配置设置后,Live-Slot 中的任何部署都指向“Live”数据库和“Live”APIUrl,而 QA-Slot 中的任何部署都指向 QA 数据库和 QA APIUrl。

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

相关问题 Web.config 用于 .net 部署到 Azure 应用服务 - Web.config for .net deployment to Azure app service 具有数据库迁移的Azure Web App部署槽 - Azure Web App deployment slots with database migration 如何在Azure中的不同插槽中使用不同的Web.config文件 - How to have different Web.config files for different slots in Azure 对于Azure应用程序部署中的许多参数之一,参数化Web.config失败 - Parameterizing Web.config fails for one of many parameters in Azure app deployment 如何为MEAN应用程序的Azure部署定义web.config文件? - How to define a web.config file for Azure deployment for a MEAN application? Web.config转换Azure项目部署的问题 - Web.config Transform Issue with Azure Project Deployment 使用Github web.config转换的Azure部署 - Azure Deployment using Github web.config transformations 在Azure部署期间(大幅度)更改了Web.config - Web.config altered (drastically) during Azure deployment Azure Web应用程序-其他部署插槽会影响生产插槽吗? - Azure web app - Additional deployment slots affect production slot? Azure 资源管理器 | Web 应用槽配置 | 应用服务身份验证 - Azure Resource Manager | Web App Slots Config | App Service Authentication
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM