使用RoleEnvironment获取配置时出错

时间:2012-04-20 05:08:26

标签: asp.net-mvc-3 razor azure

我的网络应用正在使用带剃须刀的MVC3

如果我尝试使用RoleEnvironment.GetConfigurationSettingValue(“senderName”)从ServiceConfig中读取任何内容 我收到与Microsoft.IdentityModel相关的错误

Unable to find assembly 'Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Runtime.Serialization.SerializationException: Unable to find assembly 'Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace: 


[SerializationException: Unable to find assembly 'Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.]
   System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) +4727747
   System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) +1725
   System.AppDomain.get_Id() +0
   <CrtImplementationDetails>.DoCallBackInDefaultDomain(IntPtr function, Void* cookie) +185
   <CrtImplementationDetails>.LanguageSupport._Initialize(LanguageSupport* ) +328
   <CrtImplementationDetails>.LanguageSupport.Initialize(LanguageSupport* ) +102

[ModuleLoadException: The C++ module failed to load while attempting to initialize the default appdomain.
]

我确实使用Windows身份基础进行Azure acs身份验证。但是当我部署到azure时,一切正常。但是如果我使用RoleEnvironment从我的ServiceConfig文件中读取任何设置(例如:RoleEnvironment)。 GetConfigurationSettingValue(“Smtpserver”))。它在azure上失败。

但是我的本地azure appfabric的一切都运行正常。如果我删除这行代码,那么所有工作都很好。RoleEnvironment.GetConfigurationSettingValue("Smtpserver")) 我在我的云应用程序中使用了两个webroles。 请帮我确定错误原因

1 个答案:

答案 0 :(得分:0)

您是如何在Azure上安装WIF的?

最可靠的方法是通过启动任务安装WIF运行时。你看看this question here。我认为this one完全相同。