【问题标题】:Custom configuration section in Azure Cloud ServiceAzure 云服务中的自定义配置部分
【发布时间】:2013-08-18 09:27:42
【问题描述】:

是否可以像在常规 ASP.NET 网站中一样在 Azure 云服务配置中自定义配置部分?

即在常规 ASP.NET 站点中,您的 Web.Config 将具有以下内容:

<configuration>
  <configSections>
     <section name="myCustomConfig" type="MyNamespace.MyType" />
  </configSections>
  <myCustomConfig someProperty="someValue" />
</configuration>

这是如何在云服务中完成并在多个不同角色之间共享的?

【问题讨论】:

    标签: iis azure web-config azure-web-roles custom-configuration


    【解决方案1】:

    目前我不相信这是可能的。有一个关于用户声音的帖子,您可以投票:http://www.mygreatwindowsazureidea.com/forums/169386-cloud-services-web-and-worker-role-/suggestions/459944-enable-custom-configuration-sections-in-csdef-cscf

    作为一种解决方法,您可以将配置放入存储在 BLOB 存储中的文件中。在启动时或需要时,所有实例都可以去拉文件以获取配置。要处理对配置的更改,您可以让实例不时提取配置作为复习,或者您可以利用 RoleEntryPoint 中用于检测服务配置更改的环境更改事件。将设置添加到服务配置中,该设置是共享配置文件的版本号或其他内容,任何可以修改以触发RoleEnvironment.Changing 事件的内容。

    【讨论】:

      猜你喜欢
      • 2015-06-17
      • 2019-01-19
      • 2014-12-15
      • 2013-05-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-03
      相关资源
      最近更新 更多