可能重复:
AppFabric 客户端虚拟机问题
我可以成功地从我的开发机器连接到应用结构缓存集群服务器。但是,当我尝试通过 VMWare VM 托管的 .net 应用程序进行操作时,出现以下错误:
System.ServiceModel.Security.SecurityNegotiationException:服务器已拒绝客户端凭据。---> System.Security.Authentication.InvalidCredential 异常:服务器已拒绝客户端凭据
请帮忙。
我的代码和配置文件如下:
try
{
var cacheFactory = new DataCacheFactory();
var cache = cacheFactory.GetCache("default");
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());
}
catch (Exception ex)
{
if (ex.InnerException != null)
{
Console.WriteLine(ex.InnerException.ToString());
}
else
{
Console.WriteLine(ex.ToString());
}
}
Console.ReadLine();
配置文件如下:
<?xml version="1.0"?>
<configuration>
<configSections>
<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>
<!-- add comments about adding machines..-->
<dataCacheClient>
<!--<localCache isEnabled="true" />-->
<localCache
isEnabled="true"
sync="NotificationBased"
objectCount="10000"
ttlValue="60" />
<hosts>
<host name="mycacheclusterservermachinename" cachePort="22233"/>
</hosts>
</dataCacheClient>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
</configuration>