尝试获取和放置域之间时出现缓存错误 [英] Caching Error when trying to fetch and put between domains

查看:91
本文介绍了尝试获取和放置域之间时出现缓存错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在运行c# 客户端时遇到问题,并从域1中的计算机上放入或读取域2中的Appfabric缓存服务器。当我将客户端移动到domain2中的另一台计算机时,它完美地工作。我已经禁用了安全
,正如我所说的那样,
它可以在domain2中的任何计算机或服务器上运行,但不能从domain1运行。

我得到的错误是:


ErrorCode< ERRCA0016> ;:SubStatus< ES0001>:连接已终止,可能是由于服务器或网络问题或序列化对象大小大于服务器上的MaxBufferSize。请求的结果未知。


 以下是代码:


   DataCacheFactory myCacheFactory;

            DataCache myDefaultCache;


          

            // -------------------------

         ;&NBSP;&NBSP;&NBSP; //配置缓存客户端


            // -------------------------


       &NBSP;&NBSP;&NBSP;&NBSP;&NBSP; //为1个缓存主机定义数组

           列表与LT; DataCacheServerEndpoint> servers = new List< DataCacheServerEndpoint>(1);


            //指定缓存主机详细信息


            //&NBSP;参数1 =主机名

            //&NBSP;参数2 =缓存端口号

            servers.Add(新DataCacheServerEndpoint(QUOT; ptpseelm-nt4097.domain2.com" ;, 22233));

&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; &NBSP; servers.Add(新DataCacheServerEndpoint(QUOT; ptpseelm-nt4098.domain2.com" ;, 22233));


&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP ;&NBSP;&NBSP; //创建缓存配置

            DataCacheFactoryConfiguration配置=新DataCacheFactoryConfiguration();


            //设置缓存主机

            configuration.Servers = servers;


            //设置本地缓存的默认属性(禁用本地缓存)

            configuration.LocalCacheProperties = new DataCacheLocalCacheProperties();


            configuration.SecurityProperties =新DataCacheSecurity(DataCacheSecurityMode.None,DataCacheProtectionLevel.None);


&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; //新Da​​taCacheFactory(EPS,真实,真实的,100,DataCacheLocalCacheSyncPolicy.TimeoutBased,10000,200);


&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP ; 




            //禁用异常消息,因为此示例可以在缓存旁边工作

            DataCacheClientLogManager.ChangeLogLevel(System.Diagnostics.TraceLevel.Off);


&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; //将配置设置传递给cacheFactory构造函数

            myCacheFactory =新DataCacheFactory(配置);


&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; //获取对命名缓存的引用,称为"默认""&bbsp;           myDefaultCache = myCacheFactory.GetCache(QUOT; IAP");




&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP ;&NBSP; //将产品放入缓存中$
            myDefaultCache.Put(QUOT; Product100","赫普");

&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;


            //从缓存中获取产品

            //产品p =(产品)cache.Get(" Product100");

            string p =(string)myDefaultCache.Get(" Product100");

            Console.WriteLine(p);


            Console.ReadLine();


            // bool createRegionStatus = myDefaultCache.CreateRegion(" ServiceAccess");

         

&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;


&NBSP;&NBSP;&NBSP;&NBSP;&NBSP ;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; // if(createRegionStatus == true)

            // {

            //&NBSP;&NBSP;&NBSP; Console.WriteLine(QUOT; PASS ---> CreateRegion");

&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; //}


         //&NBSP;&NBSP; var s = myCacheFactory.GetDefaultCache();


这是服务器上的配置。


<?xml version =" 1.0" encoding =" utf-8"?>

< configuration>

    < configSections>

        < section name =" dataCache" type =" Microsoft.ApplicationServer.Caching.DataCacheSection,Microsoft.ApplicationServer.Caching.Core,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35" />
$
    < / configSections>

    < dataCache size =" Small">

        < caches>           < cache consistency =" StrongConsistency"名称= QUOT; IAP">

&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; < eviction type =" Lru" />

&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; < expiration defaultTTL =" 10" isExpirable = QUOT;真" />               < / policy>

            < / cache>

        < / caches>

        < hosts>

            < host replicationPort =" 22236" arbitrationPort = QUOT; 22235" clusterPort =" 22234"

                HOSTID = QUOT; 1502503816"大小= QUOT; 1023" leadHost = QUOT;真"帐户= QUOT; DOMAIN2\PTPSEELM-NT4097 $"

&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP ; cacheHostName = QUOT; AppFabricCachingService" name =" PTPSEELM-NT4097"&bbsp;                cachePort = QUOT; 22233" />
$
            < host replicationPort =" 22236" arbitrationPort = QUOT; 22235" clusterPort = QUOT; 22234"

&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; HOSTID = QUOT; 30583047"大小= QUOT; 1023" leadHost = QUOT假QUOT;帐户= QUOT; DOMAIN2\PTPSEELM-NT4098 $"

&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP ; cacheHostName = QUOT; AppFabricCachingService" name =" PTPSEELM-NT4098"&bbsp;                cachePort = QUOT; 22233" />
$
        < / hosts>

        < advancedProperties>

            < securityProperties mode =" None"的ProtectionLevel = QUOT;无" />
$
        < / advancedProperties>

    < / dataCache>

< / configuration>


 


 


&NBSP;

解决方案

在Visual Studio 2010中的智能跟踪寻找,你可以找出真正的例外,而不是< br $>

ErrorCode< ERRCA0016>:SubStatus< ES0001>:连接已终止,可能是由于服务器或网络问题或序列化对象大小大于服务器上的MaxBufferSize。请求的结果未知。


我发现服务器抱怨ptpseelm-nt4097没有DNS条目。


然后我开始在本地主机文件中添加servername和ip,但它仍然有效。

我真的厌倦了那些奇怪的行为。 / p>


I am having problems running a c# client and put or read from computer on domain1 to the Appfabric Cache Servers in domain2. When i move the client to another computer in domain2 it works perfectly. I have disabled the security and as i said
it works from any computer or server in domain2 but not from domain1.
The error i get is:

ErrorCode<ERRCA0016>:SubStatus<ES0001>:The connection was terminated, possibly due to server or network problems or serialized Object size is greater than MaxBufferSize on server. Result of the request is unknown.

 Here is the code:

   DataCacheFactory myCacheFactory;
            DataCache myDefaultCache;

          
            //-------------------------
            // Configure Cache Client
            //-------------------------

            //Define Array for 1 Cache Host
            List<DataCacheServerEndpoint> servers = new List<DataCacheServerEndpoint>(1);

            //Specify Cache Host Details
            //  Parameter 1 = host name
            //  Parameter 2 = cache port number
            servers.Add(new DataCacheServerEndpoint("ptpseelm-nt4097.domain2.com", 22233));
            servers.Add(new DataCacheServerEndpoint("ptpseelm-nt4098.domain2.com", 22233));

            //Create cache configuration
            DataCacheFactoryConfiguration configuration = new DataCacheFactoryConfiguration();

            //Set the cache host(s)
            configuration.Servers = servers;

            //Set default properties for local cache (local cache disabled)
            configuration.LocalCacheProperties = new DataCacheLocalCacheProperties();

            configuration.SecurityProperties = new DataCacheSecurity(DataCacheSecurityMode.None, DataCacheProtectionLevel.None);

            //new DataCacheFactory(eps, true, true, 100, DataCacheLocalCacheSyncPolicy.TimeoutBased, 10000, 200 );

          


            //Disable exception messages since this sample works on a cache aside
            DataCacheClientLogManager.ChangeLogLevel(System.Diagnostics.TraceLevel.Off);

            //Pass configuration settings to cacheFactory constructor
            myCacheFactory = new DataCacheFactory(configuration);

            //Get reference to named cache called "default"
            myDefaultCache = myCacheFactory.GetCache("IAP");


            // Putting a product in cache
            myDefaultCache.Put("Product100", "hepp");
           

            // Getting Product from cache
            //Product p = (Product)cache.Get("Product100");
            string p = (string)myDefaultCache.Get("Product100");
            Console.WriteLine(p);

            Console.ReadLine();

            //bool createRegionStatus = myDefaultCache.CreateRegion("ServiceAccess");
         
           

            //if (createRegionStatus == true)
            //{
            //    Console.WriteLine("PASS--->CreateRegion ");
            //}

         //   var s = myCacheFactory.GetDefaultCache();

AND here is the configuration on server.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <configSections>
        <section name="dataCache" type="Microsoft.ApplicationServer.Caching.DataCacheSection, Microsoft.ApplicationServer.Caching.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
    </configSections>
    <dataCache size="Small">
        <caches>
            <cache consistency="StrongConsistency" name="IAP">
                <policy>
                    <eviction type="Lru" />
                    <expiration defaultTTL="10" isExpirable="true" />
                </policy>
            </cache>
        </caches>
        <hosts>
            <host replicationPort="22236" arbitrationPort="22235" clusterPort="22234"
                hostId="1502503816" size="1023" leadHost="true" account="DOMAIN2\PTPSEELM-NT4097$"
                cacheHostName="AppFabricCachingService" name="PTPSEELM-NT4097"
                cachePort="22233" />
            <host replicationPort="22236" arbitrationPort="22235" clusterPort="22234"
                hostId="30583047" size="1023" leadHost="false" account="DOMAIN2\PTPSEELM-NT4098$"
                cacheHostName="AppFabricCachingService" name="PTPSEELM-NT4098"
                cachePort="22233" />
        </hosts>
        <advancedProperties>
            <securityProperties mode="None" protectionLevel="None" />
        </advancedProperties>
    </dataCache>
</configuration>

 

 

 

解决方案

When looking at the Intellitrace in Visual Studio 2010 you can find out the real exceptions instead of
the
ErrorCode<ERRCA0016>:SubStatus<ES0001>:The connection was terminated, possibly due to server or network problems or serialized Object size is greater than MaxBufferSize on server. Result of the request is unknown.

I found out that the server is complaining about no DNS entries exists for ptpseelm-nt4097.
Then i started to add the servername and Ip in the local hosts file but still it dosent work.
im getting really tired of theese strange behaviours.


这篇关于尝试获取和放置域之间时出现缓存错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆