Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not load file or assembly Microsoft.ApplicationServer.Caching.Core

I'm trying to use Windows Azure Caching Preview.

I have one dedicated cache worker role, One webrole that use the former cache, and one worker role that continuously update cache.

I followed the instructions on the Windows Azure guide but I still get an error :

Could not load file or assembly 'Microsoft.ApplicationServer.Caching.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

I double triple 1000000 checked dependencies, there are correct. I noticed there were two sets of dlls : the ones version 1.0.0.0 I want to use, and another version 101.0.0.0 I don't want. I added BindingRedirect statement to all my .config files to map 101 versions to 1.0.0.0 I checked the \bin folder, decompiled the dlls with Jetbrains, they are correct. I begin to lose patience. Why doesn't .NET take the DLL I specify when I put the explicit path ?

like image 644
Rodolphe Beck Avatar asked Aug 14 '12 13:08

Rodolphe Beck


2 Answers

Ok I found another way : I just renamed C:\Program Files\Microsoft SDKs\Windows Azure.NET SDK\2012-06\ref\Microsoft.ApplicationServer.Caching.Core.dll to Microsoft.ApplicationServer.Caching.Core.dll_old.

It was enought for me.

Here is a more specific description of th issue : it seems to work perfectly when taking projects individually : I have 3 worker roles and one web role. Each time I build my project one by one, I see the correct dll in output directory, I only have a problem with Windows Azure Cloud package, it seems to ignore the BindingRedirect directive.

like image 100
Rodolphe Beck Avatar answered Oct 01 '22 15:10

Rodolphe Beck


AppFabric isn't setup to register its own DLLs after install.

You have to manually register them. Run this in powershell to fix everything:

Set-location "C:\Program Files\AppFabric 1.1 for Windows Server"            
[System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")            
$publish = New-Object System.EnterpriseServices.Internal.Publish            
$publish.GacInstall("C:\Program Files\AppFabric 1.1 for Windows Server\Microsoft.ApplicationServer.Caching.Core.dll")
$publish.GacInstall("C:\Program Files\AppFabric 1.1 for Windows Server\Microsoft.ApplicationServer.Caching.Client.dll")
$publish.GacInstall("C:\Program Files\AppFabric 1.1 for Windows Server\Microsoft.WindowsFabric.Common.dll")
$publish.GacInstall("C:\Program Files\AppFabric 1.1 for Windows Server\Microsoft.WindowsFabric.Data.Common.dll")             
iisreset
like image 20
Anonymous Avatar answered Oct 01 '22 15:10

Anonymous