Session state provider for Azure AppFabric Cache with useBlobMode=false results in error "Key referred to does not exist"
Problem
If you are using Session state provider (Windows Azure AppFabric) and configure useBlobMode=false, you might run into below error
ErrorCode<ERRCA0006>:SubStatus<ES0001>:Key referred to does not exist. Create objects based on a Key to fix the error.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: Microsoft.ApplicationServer.Caching.DataCacheException: ErrorCode<ERRCA0006>:SubStatus<ES0001>:Key referred to does not exist. Create objects based on a Key to fix the error.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. |
Stack Trace:
[DataCacheException: ErrorCode<ERRCA0006>:SubStatus<ES0001>:Key referred to does not exist. Create objects based on a Key to fix the error.] Microsoft.ApplicationServer.Caching.DataCache.ThrowException(ResponseBody respBody) +568 Microsoft.ApplicationServer.Caching.DataCache.InternalPutAndUnlock(String key, Object value, DataCacheLockHandle lockHandle, TimeSpan timeout, DataCacheTag[] tags, String region, IMonitoringListener listener) +288 Microsoft.ApplicationServer.Caching.<>c__DisplayClass8a.<PutAndUnlock>b__89() +149 Microsoft.ApplicationServer.Caching.DataCache.PutAndUnlock(String key, Object value, DataCacheLockHandle lockHandle, TimeSpan timeout) +276 Microsoft.Web.DistributedCache.<>c__DisplayClass19.<PutAndUnlock>b__18() +52 Microsoft.Web.DistributedCache.<>c__DisplayClass2e`1.<PerformCacheOperation>b__2d() +19 Microsoft.Web.DistributedCache.DataCacheRetryWrapper.PerformCacheOperation(Action action) +208 Microsoft.Web.DistributedCache.DataCacheForwarderBase.PerformCacheOperation(Func`1 func) +167 Microsoft.Web.DistributedCache.DataCacheForwarderBase.PutAndUnlock(String key, Object value, DataCacheLockHandle lockHandle, TimeSpan timeout) +162 Microsoft.Web.DistributedCache.GranularSessionStoreProvider.SetAndReleaseItemExclusiveImpl(HttpContextBase context, String id, SessionStateStoreData item, Object lockId, Boolean newItem) +3925 Microsoft.Web.DistributedCache.<>c__DisplayClass15.<SetAndReleaseItemExclusive>b__14() +47 Microsoft.Web.DistributedCache.GranularSessionStoreProvider.ExecNonAbortable(Action a) +33 System.Web.SessionState.SessionStateModule.OnReleaseState(Object source, EventArgs eventArgs) +929 System.Web.SessionState.SessionStateModule.OnEndRequest(Object source, EventArgs eventArgs) +208 System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +80 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +266 |
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.225
Cause
In this case, below configuration is being used
<sessionState mode="Custom" customProvider="AppFabricCacheSessionStoreProvider">
<providers>
<add name="AppFabricCacheSessionStoreProvider"
type="Microsoft.Web.DistributedCache.DistributedCacheSessionStateStoreProvider, Microsoft.Web.DistributedCache"
cacheName="default"
useBlobMode="false"
dataCacheClientName="default" />
</providers>
</sessionState>
useBlobMode=false is not supported scenario for cloud. The reason this mode is not supported is because, as of today, there is no control over eviction policy when cache is hosted in Windows Azure platform.
Resolution
Consider using useBlobMode=true if you are using session state provider with Windows Azure Appfabric cache.
More Info
Current MSDN documentation does not explicitly call out this scenario and will be updated shortly.
Applies To
- Windows Azure AppFabric Cache
- Session State Provider (Azure)