azure - 在 Azure 中的 Web 应用程序之间共享连接字符串

标签 azure azure-sql-database azure-web-app-service

在 Azure 中,可以将连接字符串存储在在线门户的“应用程序设置”部分中。这会覆盖 web.config 中的值,这非常有用。

问题是,我在 Azure 中有多个 Web 应用程序,它们都使用相同的连接字符串,因此我希望在门户中拥有一个通用条目,我可以在其中进行设置,并且所有应用程序都应该使用它。这是故意不可能的,因为这是不好的做法,我错过了它还是根本不可能?

最佳答案

应用程序设置始终是为应用程序在后台运行的 IIS 实例定义的。如果您有多个网络应用程序,那么它们需要重复相同的设置。

但是,您正在寻找的内容被称为 External Configuration Store pattern .

外部配置存储模式

此模式描述了您有多个应用程序的情况,其中每个应用程序都需要访问相同的配置。在此模式中,这是通过在外部保存设置来完成的,例如Azure 存储 blob。

External Configuration Store pattern

从上面的链接中,突出显示您所描述的用例:

When to use this pattern

This pattern is useful for:

  • Configuration settings that are shared between multiple applications and application instances, or where a standard configuration must be enforced across multiple applications and application instances.
  • A standard configuration system that doesn't support all of the required configuration settings, such as storing images or complex data types.
  • As a complementary store for some of the settings for applications, perhaps allowing applications to override some or all of the centrally-stored settings.
  • As a way to simplify administration of multiple applications, and optionally for monitoring use of configuration settings by logging some or all types of access to the configuration store.

关于azure - 在 Azure 中的 Web 应用程序之间共享连接字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49316016/

相关文章:

mysql - 在 Azure VM 中重新启动后 Docker 容器速度变慢

azure - 将 Azure 存储表数据清除/复制到 SQL Azure 的最快方法是什么?

Azure Sql 数据库只读

python - Azure Web 应用服务上的 Anaconda 安装

asp.net-mvc - Azure 应用服务上传大文件时出现问题 : Unexpected end of MIME multipart stream

Azure Log Analytics - 如何查看最近 x 天但仅在特定时间之间的日志?

asp.net-mvc - JWT token 通常对于使用跨源有效吗?

azure - 将项目发布到 Azure 后出现内部服务器错误 (500)

sql - 从序列对象中获取相同的序列号

asp.net - VS 到 Azure 发布失败 : Socket Error 10054