If you are using the information in this MSDN page to get started with the ASP.NET Session State Provider to use Windows Server AppFabric Caching you might run into some problems as the steps are less than complete. First make sure you have Windows Server AppFabric Caching setup and working and add the configSections and dataCacheClient elements as specified. If you next add the sessionState element as specified you will receive the following error:

Parser Error Message: Could not load type 'Microsoft.ApplicationServer.Caching.DataCacheSessionStoreProvider'

The reason is the assembly information is not specified so the .NET runtime doesn’t know where to find the DataCacheSessionStoreProvider class. The solution is simple, either add the assemblies section to the web.config or add it to the sessionState provider like this:

<sessionState mode="Custom"
              customProvider="AppFabricCacheSessionStoreProvider">
  <providers>
    <add
      name="AppFabricCacheSessionStoreProvider"
      type="Microsoft.ApplicationServer.Caching.DataCacheSessionStoreProvider, Microsoft.ApplicationServer.Caching.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
      cacheName="NamedCache1"
      sharedId="SharedApp"/>    
  </providers>
</sessionState>


We are not quite done though because if we run the application now we get a new error:

Parser Error Message: ErrorCode<ERRCA0009>:SubStatus<ES0001>:Cache referred to does not exist. Contact administrator or use the Cache administration tool to create a Cache.

This is caused by the cache name of “NamedCache1”. Chancing this to the default cache name of “default” is one way to fix the problem. The other is to create the cache named “NamedCache1” using the following PowerShell command:

New-Cache NamedCache1


Remember to run the “Caching Administration Windows PowerShell” application as administrator with elevated privileges otherwise you wont be able to manage the Windows Server AppFabric Cache and you will receive the following error:

New-Cache : ErrorCode<ERRCAdmin002>:SubStatus<ES0001>:The operation has timed out and the result is unknown. Stop the cluster and run Export-CacheClusterConfig followed by Import-CacheClusterConfig to make the cluster configuration consistent.

At line:1 char:10

+ New-Cache <<<<  NamedCache1

    + CategoryInfo          : NotSpecified: (:) [New-Cache], DataCacheExceptio

   n

    + FullyQualifiedErrorId : ERRCAdmin002,Microsoft.ApplicationServer.Caching

   .Commands.NewCacheCommand

 

See here for a complete list of PowerShell commands used to manage the Windows Server AppFabric Caching environment.

 

Enjoy!

www.TheProblemSolver.nl

Wiki.WindowsWorkflowFoundation.eu