我可以成功从我的开发机器连接到app fabric缓存集群服务器。但是当我尝试通过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>
答案 0 :(得分:0)
服务器已拒绝客户端凭据。
只要将VM添加到与我的开发计算机相同的域中,就会解决此问题。