AppFabric的1.0误差服务器收集不能为空 [英] AppFabric 1.0 error Server collection cannot be empty
本文介绍了AppFabric的1.0误差服务器收集不能为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我收到以下错误,当我运行简单的的Windows Server应用程序面料1.0 演示控制台应用程序:
错误$ C $℃下ERRCA0021>:&子状态下,ES0001>:服务器集合不能为空。
请帮助我..我在想什么..?我已经看过了互联网并没有什么对每一个地方似乎是解决这个问题。感谢..
我的应用程序如下:
静态无效的主要(字串[] args)
{
VAR厂=新Microsoft.ApplicationServer.Caching.DataCacheFactory(); < --- ***错误这里 VAR缓存= factory.GetDefaultCache();
VAR键=的myKey;
VAR OBJ =缓存[关键]
如果(OBJ == NULL)
{
缓存[关键] =我的数据高速缓存;
}
OBJ =缓存[关键]
Console.WriteLine(OBJ);
Console.Read();
}
我的app.config如下:
<?XML版本=1.0&GT?;
<结构>
< configSections>
<节名称=dataCacheClients
键入=Microsoft.ApplicationServer.Caching.DataCacheClientsSection,Microsoft.ApplicationServer.Caching.Core/>
< / configSections>
< dataCacheClients>
< dataCacheClient>
<主机>
<主机名=MyMachineNameHerecachePort =22233/>
< /主机>
< / dataCacheClient>
< / dataCacheClients>
< /结构>
解决方案
我更新了我的AppConfig如下,它的工作....
<?XML版本=1.0&GT?;
<结构> <! - configSections必须是第一个元素 - >
< configSections>
&所述;! - 需要读取的< dataCacheClient>元素 - >
<节名称=dataCacheClient
类型=Microsoft.ApplicationServer.Caching.DataCacheClientSection,
Microsoft.ApplicationServer.Caching.Core,版本= 1.0.0.0,
文化=中性公钥= 31bf3856ad364e35
allowLocation =真
allowDefinition的=无处不在/>
< / configSections> <! - 缓存客户端 - >
< dataCacheClient>
&所述;! - 高速缓存主机(S) - GT;
<主机>
<主机
NAME =MyMachineNameHere
cachePort =22233/>
< /主机>
< / dataCacheClient>
< /结构>
I am getting the following error when I run the simple Windows Server App Fabric 1.0 demo console application:
ErrorCode<ERRCA0021>:SubStatus<ES0001>:Server collection cannot be empty.
Please help me.. What am I missing..?? I have looked every where on the internet and nothing seems to be fixing this issue. thanks..
My application is as follows:
static void Main(string[] args)
{
var factory = new Microsoft.ApplicationServer.Caching.DataCacheFactory(); <--- *** Error here
var cache = factory.GetDefaultCache();
var key = "mykey";
var obj = cache[key];
if (obj == null)
{
cache[key] = "I am data for caching";
}
obj = cache[key];
Console.WriteLine(obj);
Console.Read();
}
My app.config is as follows:
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="dataCacheClients"
type="Microsoft.ApplicationServer.Caching.DataCacheClientsSection, Microsoft.ApplicationServer.Caching.Core" />
</configSections>
<dataCacheClients>
<dataCacheClient>
<hosts>
<host name="MyMachineNameHere" cachePort="22233" />
</hosts>
</dataCacheClient>
</dataCacheClients>
</configuration>
解决方案
I updated my appconfig as follows and it worked....
<?xml version="1.0"?>
<configuration>
<!--configSections must be the FIRST element -->
<configSections>
<!-- required to read the <dataCacheClient> element -->
<section name="dataCacheClient"
type="Microsoft.ApplicationServer.Caching.DataCacheClientSection,
Microsoft.ApplicationServer.Caching.Core, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35"
allowLocation="true"
allowDefinition="Everywhere"/>
</configSections>
<!-- cache client -->
<dataCacheClient>
<!-- cache host(s) -->
<hosts>
<host
name="MyMachineNameHere"
cachePort="22233"/>
</hosts>
</dataCacheClient>
</configuration>
这篇关于AppFabric的1.0误差服务器收集不能为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文