【问题标题】:Error in using RoleEnvironment to get Configuration使用 RoleEnvironment 获取配置时出错
【发布时间】:2012-04-20 13:19:14
【问题描述】:

我的网络应用正在使用 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.
]

.

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

但是在我的本地 azure appfabric 上一切正常。如果我删除这行代码,那么一切正常。RoleEnvironment.GetConfigurationSettingValue("Smtpserver")) 我在我的云应用程序中使用了两个 webrole。 请帮我找出错误的原因

【问题讨论】:

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


    【解决方案1】:

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

    最可靠的方法是通过启动任务安装 WIF 运行时。您查看this question here。而且我认为this one 是完全重复的。

    【讨论】:

    • 仅当我尝试从 ServiceConfig 读取设置时才发现此错误。否则一切正常。
    • 您是否彻底检查了引用的问题及其答案?
    • 如果我正在远程处理我的 azure webrole,我可以看到 WIF 已安装。
    • 检查我对stackoverflow.com/questions/10206022/… 的回答中的 cmets - 如果您有 VS Ultimate,请尝试使用 Intellitrace 查找问题。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-02-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-12-24
    • 2013-10-30
    相关资源
    最近更新 更多