如何在不使用配置转换的情况下将 Azure webapp 部署到多个环境

How to deploy Azure webapp to multiple environments without using config transforms

我有一个使用 EF DB 优先模型的多层 Azure Web 应用程序。我想将它部署在开发、测试、暂存和生产环境中。每个环境都有不同的数据库连接字符串以及不同的ida:PostLogoutRedirectUri url。有什么方法可以跳过使用 Web 配置转换,只使用应用程序设置来管理到多个环境的部署。

我能够使用 Azure 门户中应用程序设置中的连接字符串。但不确定如何在应用程序设置中配置 PostLogoutRedirectUri 并在 web.config.

中使用该值

But not sure how to configure PostLogoutRedirectUri in app settings and use that value in web.config

以下适用于 Azure 应用服务中 .NET 应用程序的所有设置:

App settings
This section contains name/value pairs that your app will load on start up.

  • For .NET apps, these settings are injected into your .NET configuration AppSettings at runtime, overriding existing settings.

来源:Configure apps in Azure App Service

简单地说,这意味着:
- 如果设置仅在 web.config 中,您的应用程序将 使用 配置文件中的值
- 如果设置也在应用程序设置下,它将覆盖配置

中的值

因此将 base/default 值放入您的配置中,并在必要时在应用程序设置中覆盖它。

编辑:
您不应该查看配置来检查该值是否已被替换。该文件 NOT 转换或更改,值在运行时注入。否则,更改应用程序设置下的设置将意味着应用程序回收(因为它会更改 web.config 文件)。