Azure云服务 - 未设置环境变量

时间:2016-08-02 00:36:08

标签: azure azure-cloud-services

我的Cloud Service中的角色未设置任何自定义环境变量。 - 如果我枚举调用Environment.GetEnvironmentVariables()的结果,则只会设置标准环境变量(PATH或用户ID)。

当我使用模拟器在本地调试Cloud Service时,envvars就在那里,所以我在这里有点不知所措。

相关的.csdef:

<WebRole name="..." vmsize="Small">
    <ConfigurationSettings>
      <Setting name="FirstSetting" />
      <Setting name="AnotherSetting" />
    </ConfigurationSettings>
    <Runtime>
      <Environment>
        <Variable name="FirstSettingEnvVar">
          <RoleInstanceValue xpath="/RoleEnvironment/CurrentInstance/ConfigurationSettings/ConfigurationSetting[@name='FirstSetting']/@value" />
        </Variable>
        <Variable name="SecondSettingEnvVar">
          <RoleInstanceValue xpath="/RoleEnvironment/CurrentInstance/ConfigurationSettings/ConfigurationSetting[@name='SecondSetting']/@value" />
        </Variable>
      </Environment>
    </Runtime>

和相关的.cscfg:

<Role name="...">
    <Instances count="2" />
    <ConfigurationSettings>
      <Setting name="FirstSetting" value="ABCD" />
      <Setting name="SecondSetting" value="WXYZ" />
    </ConfigurationSettings>
</Role>

0 个答案:

没有答案