Asp.net mvc 3 使用RoleEnvironment获取配置时出错

Asp.net mvc 3 使用RoleEnvironment获取配置时出错,asp.net-mvc-3,razor,azure,Asp.net Mvc 3,Razor,Azure,我的web应用程序正在使用MVC3和razor 如果我试图使用RoleEnvironment.GetConfigurationSettingValue(“senderName”)从ServiceConfig读取任何内容 我收到与Microsoft.IdentityModel相关的错误 Unable to find assembly 'Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856

我的web应用程序正在使用MVC3和razor

如果我试图使用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.
]
找不到程序集“Microsoft.IdentityModel,版本=3.5.0.0,区域性=中性,PublicKeyToken=31bf3856ad364e35”。
描述:执行当前web请求期间发生未处理的异常。请查看堆栈跟踪以了解有关错误的更多信息以及错误在代码中的起源。
异常详细信息:System.Runtime.Serialization.SerializationException:找不到程序集“Microsoft.IdentityModel,版本=3.5.0.0,区域性=中性,PublicKeyToken=31bf3856ad364e35”。
源错误:
在执行当前web请求期间生成了未经处理的异常。有关异常的起源和位置的信息可以使用下面的异常堆栈跟踪来识别。
堆栈跟踪:
[序列化异常:找不到程序集'Microsoft.IdentityModel,版本=3.5.0.0,区域性=中性,PublicKeyToken=31bf3856ad364e35'
System.Runtime.Remoting.proxy.RealProxy.HandleReturnMessage(IMessage reqMsg,IMessage retMsg)+4727747
System.Runtime.Remoting.proxy.RealProxy.PrivateInvoke(MessageData&msgData,Int32类型)+1725
System.AppDomain.get_Id()+0
.DoCallBackInDefaultDomain(IntPtr函数,Void*cookie)+185
.LanguageSupport._初始化(LanguageSupport*)+328
.LanguageSupport.Initialize(LanguageSupport*)+102
[MultReloDeXPcExc:C++模块在初始化默认AppDe域时加载失败。
]

这是真的,我正在使用Windows身份基础进行Azure ACS认证。但是当我部署到Azure时,一切都很好。但是如果我使用ReLead环境来读取我的Service EngFIG文件中的任何设置(对于EX:ReLeaveLe.GetConfigurationSettingValue(“SMTPServer”)),它在Azure上的失败。 但是在我的本地azure appfabric上一切都正常。如果我删除这行代码,那么所有工作都正常。

roleenEnvironment.GetConfigurationSettingValue(“Smtpserver”)
我在我的云应用程序中使用了两个WebRole。
请帮助我确定错误原因

您是如何在Azure上安装WIF的


最可靠的方法是通过启动任务安装WIF运行时。你退房。我认为这是完全重复的。

只有在尝试从ServiceConfig读取设置时,我才发现此错误。否则一切都很好。您是否彻底检查了引用的问题及其答案?如果我正在远程转移到我的azure webrole,我可以看到安装了WIF。检查我的答案上的注释-如果您有VS Ultimate,请尝试使用Intellitrace查找问题。