Initializing Cache on a WebRole erroring


  • I have a MVC3 app I am working on that I plan to host in azure, I have a 20 lines of initialization code in the Application_Start.  It works locally, however when in the cloud it errors saying "Request is not available in this context".  Searching for that, people suggested that you should move that to WebRole.OnStart().  I did this, however now when I call GetDefaultCache() I get:

    Microsoft.ApplicationServer.Caching.DataCacheException: ErrorCode<ERRCA0021>:SubStatus<ES0001>:Server collection cannot be empty.

    The configuration works just fine if I run the webiste by itself (not hosting in the dev fabric).  It also runs fine if I trigger the setup of the datacache in the first Application_BeginRequest call. 

    Monday, April 18, 2011 7:57 PM

All replies

  • Did you try moving the same client config to the WebRole config instead of the MVC app config?

    Saturday, April 23, 2011 9:55 PM