AppFabric: Cache host cannot load provider assembly for read-through and write-behind


I want to try out the new read-through/write-behind feature of AppFabric 1.1. I implemented a provider that references some other own assemblies, according to All are signed and compiled for AnyCPU. I put the provider and all referenced assemblies in the GAC (see Then I stopped the cache cluster and created a new cache with the read-through and write-behind options passing the full name of my provider assembly (that I got from gacutil -l).

New-Cache ReadThroughWriteBehindCache -ReadThroughEnabled true -WriteBehindEnabled true 
-WriteBehindInterval 60 -ProviderType "CachingDemo.Provider, Version=, Culture=neutral,
PublicKeyToken=236fd28d53a6f1ad" -ProviderSettings @{"connectionString"="Data Source=.;Initial
Catalog=Demo;Persist Security Info=True;User 

When starting the cache cluster again I got a timeout and following error message in the event log:

AppFabric Caching service crashed with exception Microsoft.ApplicationServer.Caching.DataCacheException:
ErrorCode<ERRCMS0007>:SubStatus<ES0001>:Provider "CachingDemo.Provider, Version=, 
Culture=neutral, PublicKeyToken=236fd28d53a6f1ad" instantiation failed: The given assembly name 
or codebase was invalid. (Exception from HRESULT: 0x80131047)  ---> System.IO.FileLoadException:
The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)

What could possibly be wrong? I triple-checked the assembly name. The name I passed when creating the cache is exactly the same as the one I get from gacutil -l. The assembly is AnyCPU what should work in any case. Since the assembly is not even loaded errors inside the assembly can be ruled-out.

asked on Stack Overflow Nov 16, 2013 by Jürgen Bayer

1 Answer


The reason was that the provider type information was not correctly passed when creating the cache. I assumed that AppFabric would find the provider itself (by reflection). But we have to add the provider type in the ProviderType argument. Additionaly between the type and the assembly information only a comma is allowed (not a comma with a space for example):

New-Cache ReadThroughWriteBehindCache -ReadThroughEnabled true -WriteBehindEnabled true
-WriteBehindInterval 60 -ProviderType CachingDemo.Provider.Provider,CachingDemo.Provider, 
Version=, Culture=neutral, PublicKeyToken=236fd28d53a6f1ad" 
-ProviderSettings @{"connectionString"="Data Source=.;
Initial Catalog=Demo;Persist Security Info=True;
User ID=sa;Password=password;MultipleActiveResultSets=True";
answered on Stack Overflow Nov 17, 2013 by Jürgen Bayer

User contributions licensed under CC BY-SA 3.0