DataCacheLocalCacheProperties

DataCacheLocalCacheProperties

本文介绍了AppFabric缓存异常:目标主体名称不正确。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在,有两台计算机,一台用于服务器(主机名:server01),一台用于客户端。  我安装了AppFabric服务  在服务器计算机中,并在客户端计算机中安装了AppFabric客户端。
我在服务器计算机中配置了服务器AppFabric,我为缓存服务配置提供程序选择了SQL,帐户是域帐户。
然后我将PowerShell运行到start-cachehost,新的-cache -cachename默认运行。这一切都成功了。

最后,我下载了演示项目(Contention),在客户端计算机上运行以在服务器缓存中运行缓存。

Now, there are two computers, one for server(hostname: server01), one for client. I installed AppFabric service in server computer, and installed AppFabric client in client computer.I configured server AppFabric in server computer, and I selected SQL for the Caching Service configuration provider, account is domain account.Then I ran PowerShell to start-cachehost, and new –cache –cachename default. It all succeeded.
At last , I download the demo project (Contention), run in client computer to operate cache in server cache.

// Configure Cache Client When loading form
        private void ContentionDemo_Load(object sender, EventArgs e)
        {
            try
            {
                //Array for the Cache Host
                List<DataCacheServerEndpoint> servers = new List<DataCacheServerEndpoint>(1);

                //缓存主机详细信息
                servers.Add(新DataCacheServerEndpoint(QUOT; SERVER01" ;, 22233));

                //Cache Host Details
                servers.Add(new DataCacheServerEndpoint("server01", 22233));

&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP ;&NBSP; //在刚刚添加的服务器上创建具有禁用的本地缓存(默认)的缓存配置
                ; DataCacheFactoryConfiguration配置=新DataCacheFactoryConfiguration();
                configuration.Servers = servers;
                configuration.LocalCacheProperties =新DataCacheLocalCacheProperties();

                //Create cache configuration with disabled local cache (default) on the just added server
                DataCacheFactoryConfiguration configuration = new DataCacheFactoryConfiguration();
                configuration.Servers = servers;
                configuration.LocalCacheProperties = new DataCacheLocalCacheProperties();

&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; //创建非本地缓存cacheFactory构造函数
                myCacheFactory = new DataCacheFactory(配置);

                //Create the Non local cache cacheFactory constructor
                myCacheFactory = new DataCacheFactory(configuration);

                //创建本地缓存cacheFactory构造函数,保留5分钟。
                configuration.LocalCacheProperties =新DataCacheLocalCacheProperties(1000,新的时间跨度(0,5,0),
&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP ;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP ;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; DataCacheLocalCacheInvalidationPolicy .TimeoutBased);
&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; myCacheFactory_LC =新的DataCacheFactory(配置);

                //Create the local cache cacheFactory constructor, kept for 5 min.
                configuration.LocalCacheProperties = new DataCacheLocalCacheProperties(1000, new TimeSpan(0, 5, 0),
                                                                DataCacheLocalCacheInvalidationPolicy.TimeoutBased);
                myCacheFactory_LC = new DataCacheFactory(configuration);

                //获取参考缓存"默认"                myDefaultCache = myCacheFactory.GetDefaultCache();
                //最小化异常消息
                DataCacheClientLogManager.ChangeLogLevel(System.Diagnostics.TraceLevel.Off);
&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; }
&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; catch(System.Exception ex)
            {
&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; tStatus.Text = ex.ToString();
            }
&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; }

                //Get tje reference cache "default"
                myDefaultCache = myCacheFactory.GetDefaultCache();
                //Minimize exception messages
                DataCacheClientLogManager.ChangeLogLevel(System.Diagnostics.TraceLevel.Off);
            }
            catch (System.Exception ex)
            {
                tStatus.Text = ex.ToString();
            }
        }


抛出异常:


致SSPI的电话失败    innerception:目标主体名称不正确。

如果我将代码更改为:

servers.Add(new DataCacheServerEndpoint(" localhost" ,, 22233));

servers.Add(new DataCacheServerEndpoint("localhost", 22233));

并在我安装AppFabric的同一台服务器上运行此Windows应用程序,完全没问题。问题只发生在客户端。

and run this windows app on the same server that I install AppFabric, no problem at all. the problem only happened on the client side.

感谢您的帮助。

推荐答案

server01是否从客户端解析?执行ping检查

Does server01 resolve from the client ? Do a ping to check that

您是否也使用  Grant-CacheAllowedClientAccount

Also did you grant access to your user using Grant-CacheAllowedClientAccount

http://msdn.microsoft.com授予您对用户的访问权限/en-us/library/ff428172%28v=ws.10%29.aspx?

http://msdn.microsoft.com/en-us/library/ff428172%28v=ws.10%29.aspx ?


这篇关于AppFabric缓存异常:目标主体名称不正确。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-31 04:25