0

I get the following error when I invoke the call factory.GetDefaultCache()...

ErrorCode:SubStatus:Cache referred to does not exist. Contact administrator or use the Cache administration tool to create a Cache.

Please help.. thanks..

Here is my simple application:

var config = new Microsoft.ApplicationServer.Caching.DataCacheFactoryConfiguration();
var servers = new List<Microsoft.ApplicationServer.Caching.DataCacheServerEndpoint>();
servers.Add(new Microsoft.ApplicationServer.Caching.DataCacheServerEndpoint("mymachine123", 22233));
config.Servers = servers;
var factory = new Microsoft.ApplicationServer.Caching.DataCacheFactory(config);

////var factory = _cacheFactory;

var cache = factory.GetDefaultCache();  <---- *** Error happens here..***
var key = "mykey";
var obj = cache[key];
if (obj == null)
{
    cache[key] = "I am data for caching";
}
obj = cache[key];
Console.WriteLine(obj);

When I run the command: start-cachecluster, I get the following:

HostName : CachePort Service Name Service Status Version Info -------------------- ------------ -------------- ------------ mymachine123:22233 AppFabricCachingService UP 1 [1,1][1,1]

dotnet-practitioner
  • 13,968
  • 36
  • 127
  • 200

1 Answers1

2

Having just set this up myself.. it may be a permissions issue. Add the user that the caching service is running under via Grant-CacheAllowedClientAccount <youraccountname>

gudatcomputers
  • 2,822
  • 2
  • 20
  • 27
  • My code worked the next day with out any changes.. I did not manually start the caching service.. but used the command start-cachecluster to start the service.. that could have made the difference but thank you for your answer any ways.. – dotnet-practitioner Nov 07 '12 at 16:54
  • if the appfabric server is accessed by IIS then you have to give the permission to iis user(IIS_IUSRS) and if it is the production environment then you might have to give the permission to AppPool/YourApplicationPool_InIIs – tharo May 07 '15 at 04:37