我刚刚将我的天蓝色项目从 sdk 版本 1.4 移动到 2.1。
此举之后,我无法在本地计算机上启动 azure 角色。我收到以下错误:
[SEHException (0x80004005): External component has thrown an exception.]
RdGetApplicationConfigurationSetting(UInt16* , UInt16** ) +0
RoleEnvironmentGetConfigurationSettingValueW(UInt16* pszName, UInt16* pszDest, UInt32 cchDest, UInt32* pcchRequiredDestSize) +82
Microsoft.WindowsAzure.ServiceRuntime.Internal.InteropRoleManager.GetConfigurationSetting(String name, String& ret) +232
Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.GetConfigurationSettingValue(String configurationSettingName) +67
Surfmark.MVC.WebRole.FirstRequestInitialization.ApplicationStartUponFirstRequest(HttpContext context) in C:\Dev\code\www\Surfmark.CloudService\Surfmark.MVC.WebRole\Global.asax.cs:232
Surfmark.MVC.WebRole.FirstRequestInitialization.Initialize(HttpContext context) in C:\Dev\code\www\Surfmark.CloudService\Surfmark.MVC.WebRole\Global.asax.cs:223
Surfmark.MVC.WebRole.MvcApplication.Application_BeginRequest(Object sender, EventArgs e) in C:\Dev\code\www\Surfmark.CloudService\Surfmark.MVC.WebRole\Global.asax.cs:202
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +148
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
请注意,我正在 Global.asax 的 Application_BeginRequest() 方法中调用 RoleEnvironment.GetConfigurationSettingValue()。在使用 v1.4 的 Azure SDK 时,我曾经在 Application_Start() 中调用 CloudStorageAccount.SetConfigurationSettingPublisher() 以便获取配置设置不会出错。我注意到在 v2.1 中不再存在此方法,因此我假设我可以访问 RoleEnvironment.GetConfigurationSettingValue() 而不会出错。
请让我知道我在这里做错了什么?
谢谢卡皮尔