datacacheexception引用的Cache不存在

时间:2012-11-07 03:42:49

标签: c# asp.net appfabric windows-server

当我调用call factory.GetDefaultCache()...

时出现以下错误

ErrorCode:SubStatus:引用的缓存不存在。请与管理员联系或使用缓存管理工具创建缓存。

请帮助..谢谢..

这是我的简单应用程序:

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);

当我运行命令:start-cachecluster时,我得到以下内容:

HostName:CachePort服务名称服务状态版本信息 -------------------- ------------ -------------- ---- -------- mymachine123:22233 AppFabricCachingService UP 1 [1,1] [1,1]

1 个答案:

答案 0 :(得分:2)

我自己设置了这个...它可能是一个权限问题。通过Grant-CacheAllowedClientAccount <youraccountname>

添加缓存服务正在运行的用户
相关问题