Azure configuration settings and Microsoft.WindowsAzure.CloudConfigurationManager

前端 未结 2 690
生来不讨喜
生来不讨喜 2020-12-11 02:37

Apparently Microsoft.WindowsAzure.CloudConfigurationManager.GetSettings will start by looking in ServiceConfiguration.*.cscfg and then fall back to web.config and app.config

相关标签:
2条回答
  • 2020-12-11 02:49

    You will need to add the settings to the ServiceDefinition.csdef and ServiceConfiguration.cscfg

    ex: ServiceDefinition.csdef

    <?xml version="1.0" encoding="utf-8"?>
    <ServiceDefinition name="WindowsAzure1" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2012-05.1.7">
        <WebRole name="WebRole1" vmsize="Small">
            <ConfigurationSettings>
                <Setting name="Foo"/>
            </ConfigurationSettings>
            :
        </WebRole>
    </ServiceDefinition>
    

    ex: ServiceConfiguration.cscfg

    <?xml version="1.0" encoding="utf-8"?>
    <ServiceConfiguration serviceName="WindowsAzure1" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="1" osVersion="*" schemaVersion="2012-05.1.7">
      <Role name="WebRole1">
        <Instances count="1" />
        <ConfigurationSettings>
            <Setting name="Foo" value="val"/>
        </ConfigurationSettings>
      </Role>
    </ServiceConfiguration>
    
    0 讨论(0)
  • 2020-12-11 03:02

    It will just be an appSettings key/value.

    <configuration>
      <appSettings>
        <add key="Foo" value="AzureSetting"/>
      </appSettings>
    </configuration>
    
    0 讨论(0)
提交回复
热议问题