locked
AppFabric Caching Session provider error : Key referred to does not exist. RRS feed

  • Question

  • Using Azure Appfabric caching session provider for ASP:NET, sometimes ( maybe when my session timed-out?) i'm getting this 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.ExecuteAPI(RequestBody reqMsg, IMonitoringListener listener) +29
      Microsoft.ApplicationServer.Caching.DataCache.InternalResetObjectTimeout(String key, TimeSpan newTimeout, String region, IMonitoringListener listener) +222
      Microsoft.ApplicationServer.Caching.<>c__DisplayClass68.<ResetObjectTimeout>b__67() +84
      Microsoft.ApplicationServer.Caching.DataCache.ResetObjectTimeout(String key, TimeSpan newTimeout) +233
      Microsoft.Web.DistributedCache.DataCacheRetryWrapper.PerformCacheOperation(Action action) +208
      Microsoft.Web.DistributedCache.DataCacheForwarderBase.ResetObjectTimeout(String key, TimeSpan newTimeout) +110
      System.Web.SessionState.SessionStateModule.BeginAcquireState(Object source, EventArgs e, AsyncCallback cb, Object extraData) +740
      System.Web.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +115
      System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +371
    

     

    someone has any idea ?

    Monday, May 2, 2011 10:52 PM

Answers

All replies

  • I believe this is an issue that ASP.NET want to access an session but it has expired on Azure AppFabric Cache. I think it is a SDK (the session store provider) issue because it does not correctly handle this exception. 

    Please download the latest SDK and try again. If it still does not work, please contract the azure support team. http://www.microsoft.com/windowsazure/support/.

    Wednesday, May 4, 2011 3:24 PM
  • After a lot of tests I think I can say it is a bug :

    When session ends, if you try to acces the root page using an url like http://mydomain.com/ (so, without page name) you recive the error specified .
    This error continue also refreshing the page, or recycling app-pool or restarting iis on the server...
    the only way I found to stop this error is :
    1) Clear the session cookie in order to acquire a new session
    2) Or navigate to a page different from / (for example default.aspx is ok... I know .../ and /default.aspx  should be the same thing)


    I made a test website that can be found here http://testcacheerror.cloudapp.net(just for few days... due to instance fee :) )

    and source code for this test is here http://popup.blob.core.windows.net/test/TestCachingAzureError1.zip

     

    void Application_Error(object sender, EventArgs e)
    {
    //This is my workaround :(
    Exception ex = Server.GetLastError();
    if (ex is Microsoft.ApplicationServer.Caching.DataCacheException)
    {
    HttpContext.Current.Response.Redirect("/default.aspx");
    }
    }
     in global.asax

    This post is just for share... I will contact support.

    bu if someone has a better workaround... i will be happy to use it.

     



    Friday, May 6, 2011 5:44 PM
  • Hi Fabio,

    Thanks for you contribution. I reproduced the issue by following your steps and using the repro project.

    I have submitted the issue to Microsoft Connect. https://connect.microsoft.com/netservices/feedback/details/667347/appfabric-cache-session-provider-issue.

    Thanks again.


    Wengchao Zeng
    Please mark the replies as answers if they help or unmark if not.
    If you have any feedback about my replies, please contact msdnmg@microsoft.com.
    Microsoft One Code Framework
    Monday, May 9, 2011 5:55 AM
  • We had this same error and the problem was with our Visual Studio setup.  We had multiple web projects in a solution. One project was configured to use IIS for debugging (the one using AppFabric session state) and one was configured to use Visual Studio Development Server.  We had to switch all web projects to use IIS to prevent this error.  The multiple debug environments were causing the problem.
    Wednesday, May 11, 2011 6:13 PM
  • kangell,

    but what when you deplaoy on production on Windows Azure..

    My problem was both in Visual studio debugging and in production deployment on Windows azure.

     

    Thanks, Fabio

    Thursday, May 12, 2011 9:12 AM
  • I just encountered the same issue after stepping away for a while and trying to refresh the "root" of my site. If I refresh the root url of my site I get the error:

     

    ErrorCode<ERRCA0006>:SubStatus<ES0001>:Key referred to does not exist. Create objects based on a Key to fix the error.

     

    I'm fairly confident that this issue happens when the session times out.

    If I try to access a page below the root like /page1.aspx I don't get the error, even when I return to the root of the site.

    Note that this issue only seems to occur for the "default document."

     

    Ideas for preventing error to user:

    * Download latest AppFabric SDK??   Windows Azure AppFabric SDK V2.0 CTP – May Update is latest. dlls associated w/ SDK V1.0 is giving error. Not sure if this will fix the issue.

    * Do the redirect thing as suggested by Fabio above...

    * Use Sql Azure for session state w/ the following caveat:

    Our support policy for session state using the SQL Azure database is stated as: ”Microsoft does not support SQL Session State Management using SQL Azure databases for ASP.net applications”.

    * Anyone else encountered this issue when trying to use AppFabric as custom session provider?

     

    web.config section showing sessionState:

    <sessionState mode="Custom" customProvider="AppFabricCacheSessionStoreProvider">
          <providers>
            <add name="AppFabricCacheSessionStoreProvider"
                 type="Microsoft.Web.DistributedCache.DistributedCacheSessionStateStoreProvider, Microsoft.Web.DistributedCache"
                 cacheName="default"
                 useBlobMode="true"
                 dataCacheClientName="default" />
          </providers>
        </sessionState>

     

    Thursday, June 16, 2011 6:29 PM
  • Follow up on last post... Referencing lastest dlls in Windows Azure AppFabric SDK V2.0 CTP – May Update doesn't solve problem. Also, I verified that the issue occurs when deploying to staging and locally. I'm testing a simple work around now. I'll post the results later after the session times out.
    Thursday, June 16, 2011 10:04 PM
  • Ok, it appears to be working now with the following fix. Hopefully this helps someone. I'm glad I caught this early on. If you're setting the default document and using the windows azure appfabric session provider you'll probably get this issue once the session times out AND you attempt to view the root of the site as the initial page after the session times out (w/o the filename.)

    What I did was remove the default document and used "URL Rewrite" for the root of the site.

    Works w/ these settings:

      <system.webServer>
         <modules runAllManagedModulesForAllRequests="true" />
        <rewrite>
          <rules>
            <clear />       
            <rule name="index" stopProcessing="true">
              <match url="^[\s/]*$" />
              <conditions logicalGrouping="MatchAll" />
              <action type="Rewrite" url="index.aspx" appendQueryString="true" />
            </rule>       
          </rules>
        </rewrite>

        <defaultDocument>
                <files>
                    <remove value="default.aspx" />
                    <remove value="iisstart.htm" />
                    <remove value="index.html" />
                    <remove value="index.htm" />
                    <remove value="Default.asp" />
                    <remove value="Default.htm" />
                    <remove value="index.aspx" />
                </files>
            </defaultDocument>
      </system.webServer>

     

    Not working w/ these settings:

      <system.webServer>
         <modules runAllManagedModulesForAllRequests="true" />

        <defaultDocument>
                <files>
                    <remove value="default.aspx" />
                    <remove value="iisstart.htm" />
                    <remove value="index.html" />
                    <remove value="index.htm" />
                    <remove value="Default.asp" />
                    <remove value="Default.htm" />
                    <add value="index.aspx" />
                </files>
            </defaultDocument>
      </system.webServer>

     

    Here's the error I was getting prior to fix:

    Server Error in '/' Application.

    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.ExecuteAPI(RequestBody reqMsg, IMonitoringListener listener) +29
    Microsoft.ApplicationServer.Caching.DataCache.InternalResetObjectTimeout(String key, TimeSpan newTimeout, String region, IMonitoringListener listener) +222
    Microsoft.ApplicationServer.Caching.<>c__DisplayClass68.<ResetObjectTimeout>b__67() +84
    Microsoft.ApplicationServer.Caching.DataCache.ResetObjectTimeout(String key, TimeSpan newTimeout) +233
    Microsoft.Web.DistributedCache.DataCacheRetryWrapper.PerformCacheOperation(Action action) +208
    Microsoft.Web.DistributedCache.DataCacheForwarderBase.ResetObjectTimeout(String key, TimeSpan newTimeout) +110
    System.Web.SessionState.SessionStateModule.BeginAcquireState(Object source, EventArgs e, AsyncCallback cb, Object extraData) +740
    System.Web.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +115
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +371



    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1

    Friday, June 17, 2011 4:32 AM
  • Any answers to this yet? Is it a bug? (it is not possible for me to use the url rewrite method)

    I am getting exactly the same "Key referred to does not exist... etc" error when the session times out. I added a session check on top of every page

            If Session("username") Is Nothing Then
                Response.Redirect("~/Default.aspx", False)
            End If

    but that did not do any difference.

    very, very grateful for any tips or hints!

     

     



    Friday, July 1, 2011 11:19 AM
  • Hi _KB_

    this is surely a bug.

    But in April release of Appfabric sdk it is resolved : http://msdn.microsoft.com/en-us/library/hh148155.aspx#Addendum

    Bye,
    Fabio Ferrari

    www.pop-up.it

    Tuesday, July 5, 2011 8:16 AM
  • We are getting the same problem, and we're using Windows AppFabric for custom session provider. We have roughly 4000 WatIn acceptance tests, and we can't run through them without getting this error.


    Glenn Johnson

    • Proposed as answer by Eldelcable Tuesday, March 19, 2013 3:18 PM
    • Unproposed as answer by Eldelcable Tuesday, March 19, 2013 3:18 PM
    • Proposed as answer by Eldelcable Tuesday, March 19, 2013 3:18 PM
    • Unproposed as answer by Eldelcable Tuesday, March 19, 2013 3:18 PM
    Thursday, September 6, 2012 11:19 AM
  • Hi, we have experimented ERRCA0006 errors with Appfabric 1.0 and it was due to AppFabric Cache Configuration... By default, the object expiration in a new appfabric cache (created with new-cache [name]) is 10 minutes... we changed it to 30 minutes and it seems to work.

    We changed "secundaries" value to 1 (high availability) in cache configuration too, although I personally think is some issue due to 10 minutes.

    Specifically, we created a new cache to test this issue:

    New-Cache Cache_Session -Secondaries 1 -TimeToLive 30

    I hope this could help.


    • Edited by Eldelcable Tuesday, March 19, 2013 3:23 PM
    Tuesday, March 19, 2013 3:22 PM