Azure SDK 1.4 - WIF - C ++ module did not load when trying to initialize appdomain application by default

I have an old azure application that runs on the azure 1.2 SDK and relies on WIF for authentication.

I recently tried updating it to the latest SDK (1.4).

Applications are built and run on Azure, including authentication with my STS. However, some pages on the site simply will not load the following errors.

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 

I made sure that the WIF dependency is set to copy the local - and it works - some pages work!

any ideas on how to resolve this?

Edit: error only occurs on pages that access tablestorage

+4
source share
2 answers

It seems that the error is caused by method calls from Microsoft.WindowsAzure.ServiceRuntime that change the application of your webrole's domain.

To get around this, you can hardlink the connection string to your application (or use web.config) instead of the azure configuration. (A very poor solution to this problem)

Alternatively, you can use the instructions: http://blogs.infosupport.com/blogs/eriko/archive/2011/01/14/adding-assemblies-to-the-gac-in-windows-azure.aspx to add Any builds that you have problems with the GAC Laser.

Recommended reading if you encounter a similar problem:

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

+4
source

So many people have come across this. I suppose these should be frequently asked questions. However, judiciously, I could not find the correct answer to stackoverflow. The problem here is that having Microsoft.IdentityModel.dll inside your bin directory is not enough. In several places, the Appdomain configuration does not look at / bin, so it must be global, installed in the GAC.

Follow the steps described here: http://blogs.infosupport.com/blogs/eriko/archive/2011/01/14/adding-assemblies-to-the-gac-in-windows-azure.aspx . In short, you will need to create a launch task and run the following command:

 gacutil /nologo /i .\Microsoft.IdentityModel.dll 
+2
source

Source: https://habr.com/ru/post/1345987/


All Articles