Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8366993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T13:03:07+00:00 2026-06-09T13:03:07+00:00

Using VS2012 I added the caching feature from the WebRole Properties Caching Tab. Among

  • 0

Using VS2012 I added the caching feature from the WebRole Properties Caching Tab. Among others, it generated the following XML in web.config:

  <dataCacheClients>   
     <tracing sinkType="DiagnosticSink" traceLevel="Error" />
     <dataCacheClient name="default">
         <autoDiscover isEnabled="true"  identifier="[cluster role name]"/>
         <!-- <localCache isEnabled="true" sync="TimeoutBased" objectCount="100000" ttlValue="300" /> -->
     </dataCacheClient> 
    </dataCacheClients>

Okay, great. I replaced the [cluster role name] with the name of the webrole, say “helloworld.web.” Now, when I create the DataCacheFactory or DataCache object:

  _dataCacheFactory = new DataCacheFactory();
    _defaultCache = _dataCacheFactory.GetDefaultCache();

    //Or, just this line
    _defaultCache = new DataCache(@"default");

I get the following error:

Microsoft.ApplicationServer.Caching.DataCacheException was unhandled
  HelpLink=http://go.microsoft.com/fwlink/?LinkId=164049
  HResult=-2146233088
  Message=ErrorCode<ERRCA0021>:SubStatus<ES0001>:Server collection cannot be empty.
  Source=Microsoft.ApplicationServer.Caching.Client
  ErrorCode=21
  SubStatus=-1

Some notes: 
IDE: VS2012,
Framework: 4.0
AzureSDK: June2012
Local dev machine

What am I missing?

Edit

I got it to work!

I was creating the DataCacheFactory in WebRole OnStart method, I moved it over to Application_Start in Global.asax and it seems to be working.

Sandrino explains why this is the case: https://stackoverflow.com/a/11886136/1374935

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T13:03:08+00:00Added an answer on June 9, 2026 at 1:03 pm

    In your question you talk about adding the XML to the web.config, this works for the web application being hosted in your Web Role (that’s why the code works when using it in the Application_Start method).

    But you need to know that the code in the WebRole.cs runs in a different process (before even startin the web application). That’s why it can’t read from your web.config and that’s the reason why it seemed there was no server configured.

    In order to make that code also work from your WebRole.cs you’ll need to add the XML in the config file for the process running that code. Your code runs in the WaIISHost.exe process, so you’ll need to create a new configuration file WaIISHost.exe.config, add the XML in this file and change the Copy to Output Directory property for that file to “Copy Always”.

    Read more about this WaIISHost.exe process here: New Full IIS Capabilities: Differences from Hosted Web Core

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I added the following entries in the HOSTS file. 127.0.0.1 abc.localhost.com 127.0.0.1 xyz.localhost.com Using
I am using VS2012 and having some troubles publishing an mvc4 website. None of
Not sure this is a known issue. I’m using VS2012 RC (Ultimate), and Win8
I transformed my VS2008 ASP.NET Website to a Web Application today using VS2010. So
I'm using VS2010, and yesterday I edited the Local.testsetting file (added a deployment item)
we are developing a web application using MVC3 and VS2010. We have some pdf
I'm using VS2010 together with C# and XNA 4.0. I'm following the book Learning
Using the TFS tools in VS2010, I had added a CodePlex server. I had
I'm developing my ASP.NET web app using VS2010,C#. I have a user control contained
I've just started using VS2010. I've got a largish solution that migrated successfully from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.