编程语言
首页 > 编程语言> > c# – Azure SDK 1.4 – WIF – 尝试初始化默认应用程序域时,C模块无法加载

c# – Azure SDK 1.4 – WIF – 尝试初始化默认应用程序域时,C模块无法加载

作者:互联网

我有一个旧的azure应用程序,它运行在azure 1.2 SDK上,依赖于WIF进行身份验证.

我最近一直在尝试将其更新到最新的SDK(1.4).

应用程序在Azure上编译和运行,包括使用我的STS进行身份验证.但是,网站上的某些页面不会加载抛出以下错误.

    Unable to find assembly 'Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.



[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) +4767763
   System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) +1725
   System.AppDomain.get_Id() +0
   <CrtImplementationDetails>.DoCallBackInDefaultDomain(IntPtr function, Void* cookie) +191
   <CrtImplementationDetails>.LanguageSupport._Initialize(LanguageSupport* ) +354
   <CrtImplementationDetails>.LanguageSupport.Initialize(LanguageSupport* ) +102

    [ModuleLoadException: The C++ module failed to load while attempting to initialize the default appdomain.
    ]
       <CrtImplementationDetails>.ThrowModuleLoadException(String errorMessage, Exception innerException) +50
       <CrtImplementationDetails>.LanguageSupport.Initialize(LanguageSupport* ) +169
       .cctor() +33

我已经确保将WIF依赖项设置为复制本地 – 并且它正在工作 – 某些页面可以工作!

关于如何解决这个问题的任何想法?

编辑:错误仅发生在访问tablestorage的页面上

解决方法:

看起来这个错误是由Microsoft.WindowsAzure.ServiceRuntime调用方法引起的,它改变了webrole的appdomain.

为了解决这个问题,您可以将连接字符串硬编码到应用程序中(或使用web.config)而不是azure配置. (这个问题的解决方案非常糟糕)

或者,您可以使用以下指令:http://blogs.infosupport.com/blogs/eriko/archive/2011/01/14/adding-assemblies-to-the-gac-in-windows-azure.aspx将您遇到问题的任何程序集添加到azure GAC中.

如果遇到类似问题,建议阅读:

http://social.msdn.microsoft.com/Forums/kk-KZ/windowsazuretroubleshooting/thread/35d37b41-b638-4023-aaab-b8134ac27278

http://blog.smarx.com/posts/how-to-resolve-setconfigurationsettingpublisher-needs-to-be-called-before-fromconfigurationsetting-can-be-used-after-moving-to-windows-azure-sdk-1-3

标签:c,azure,wif
来源: https://codeday.me/bug/20190531/1188000.html