我們有AppFabric緩存集羣服務器,我可以使用我的開發機器作爲客戶端使用它。爲了模擬訪問緩存集羣服務器的不同Web服務器,我創建了一個VMWare虛擬機,並安裝了Visual Studio 2010和我的Web應用程序。從VM作爲客戶端,當我嘗試獲取緩存時,出現以下錯誤...請幫助..謝謝..AppFabric客戶端虛擬機問題
ErrorCode:SubStatus:存在臨時故障。請稍後重試。 (一個或多個指定的緩存服務器不可用,這可能是由繁忙的網絡或服務器引起的)對於本地緩存羣集,還要驗證以下條件:確保已爲此客戶端帳戶授予安全權限,並檢查AppFabric緩存服務通過在所有緩存主機的防火牆。同時在服務器上MAXBUFFERSIZE必須大於或等於從客戶端發送的序列化對象的大小。)
我注意到內部異常是
服務器已拒絕客戶端憑據。
所以..經過一番研究。我添加了以下行來我的配置
<securityProperties mode="None" protectionLevel="None" />
所以,現在,我的dataCacheClient配置如下所示:
<dataCacheClients>
<dataCacheClient name="default">
<localCache
isEnabled="true"
sync="NotificationBased"
objectCount="10000"
ttlValue="5" />
<hosts>
<host name="MyCacheClusterServerMachine" cachePort="22233" />
</hosts>
<securityProperties mode="None" protectionLevel="None" />
</dataCacheClient>
上述配置變更後..我收到以下錯誤:
套接字連接被中止。這可能是由處理您的消息時出錯或遠程主機超出接收超時或基礎網絡資源問題引起的。本地套接字超時是
我的代碼與配置如下。它從我的開發機器作爲客戶端運行,但不是作爲客戶端從VM運行。我能夠從VM客戶端ping緩存集羣服務器。
class Program
{
static void Main(string[] args)
{
var config = new DataCacheFactoryConfiguration();
var servers = new List<DataCacheServerEndpoint>();
servers.Add(new DataCacheServerEndpoint("MyCacheClusterServerMachine", 22233));
config.Servers = servers;
var factory = new DataCacheFactory(config);
var cache = factory.GetDefaultCache(); <---- error here ********
var key = "CachedObjectKey";
var obj = cache[key];
if (obj == null)
{
obj = "here is a string to cache";
cache.Add(key, obj);
Console.WriteLine("object was not in cache");
}
obj = cache.Get(key);
Console.WriteLine(obj.ToString());
Console.ReadLine();
}
}