这是我的第一个天蓝色项目,我不确定我是否做错了什么。我正在尝试在 MVC 3 webrole 中获取一些配置,为此我正在使用:
RoleEnvironment.GetConfigurationSettingValue(KeyName)
当我在模拟器上运行应用程序时,我得到了他的错误:
BC30451: 'RoleEnvironment' is not declared. It may be inaccessible due to its protection level.
我尝试像这样添加完整的命名空间:
Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.GetConfigurationSettingValue(KeyName)
我得到这个错误:
BC30456: 'ServiceRuntime' is not a member of 'WindowsAzure'.
但是,我可以访问 WebRole 类的“OnStart”事件中的 RoleEnvironment。那么,这是预期的行为吗?如果是,我应该如何阅读整个项目的配置?
提前致谢;