Proposed Answer failed to add cache item with API

  • 26 มิถุนายน 2555 9:44
     
     

    hi,

    when i use the downloaded sample code, i got exception when doing add method. it say:

    Microsoft.ApplicationServer.Caching.DataCacheException was unhandled
      HelpLink=http://go.microsoft.com/fwlink/?LinkId=164049
      Message=ErrorCode<ERRCA0017>:SubStatus<ES0006>:There is a temporary failure. Please retry later. (One or more specified cache servers are unavailable, which could be caused by busy network or servers. For on-premises cache clusters, also verify the following conditions. Ensure that security permission has been granted for this client account, and check that the AppFabric Caching Service is allowed through the firewall on all cache hosts. Also the MaxBufferSize on the server must be greater than or equal to the serialized object size sent from the client.)
      Source=Microsoft.ApplicationServer.Caching.Client
      ErrorCode=17
      SubStatus=5
      StackTrace:
           at Microsoft.ApplicationServer.Caching.DataCache.ThrowException(ResponseBody respBody)
           at Microsoft.ApplicationServer.Caching.DataCache.ExecuteAPI(RequestBody reqMsg, IMonitoringListener listener)
           at Microsoft.ApplicationServer.Caching.DataCache.InternalAdd(String key, Object value, TimeSpan timeout, DataCacheTag[] tags, String region, IMonitoringListener listener)
           at Microsoft.ApplicationServer.Caching.DataCache.<>c__DisplayClass1.<Add>b__0()
           at Microsoft.ApplicationServer.Caching.MonitoringListenerFactory.EmptyListener.Microsoft.ApplicationServer.Caching.IMonitoringListener.Listen[TResult](Func`1 innerDelegate)
           at Microsoft.ApplicationServer.Caching.DataCache.Add(String key, Object value)
           at testCaching.Program.PrepareClient() in D:\Program\SpikeAppFabric\testCaching\testCaching\Program.cs:line 626
           at testCaching.Program.Main(String[] args) in D:\Program\SpikeAppFabric\testCaching\testCaching\Program.cs:line 19
           at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
           at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
           at System.Threading.ThreadHelper.ThreadStart()
      InnerException: System.ServiceModel.Security.SecurityNegotiationException
           Message=A call to SSPI failed, see inner exception.
           Source=mscorlib
           StackTrace:
             Server stack trace:
                at System.ServiceModel.Channels.WindowsStreamSecurityUpgradeProvider.WindowsStreamSecurityUpgradeInitiator.OnInitiateUpgrade(Stream stream, SecurityMessageProperty& remoteSecurity)
                at System.ServiceModel.Channels.StreamSecurityUpgradeInitiatorBase.InitiateUpgrade(Stream stream)
                at System.ServiceModel.Channels.ConnectionUpgradeHelper.InitiateUpgrade(StreamUpgradeInitiator upgradeInitiator, IConnection& connection, ClientFramingDecoder decoder, IDefaultCommunicationTimeouts defaultTimeouts, TimeoutHelper& timeoutHelper)
                at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.SendPreamble(IConnection connection, ArraySegment`1 preamble, TimeoutHelper& timeoutHelper)
                at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.DuplexConnectionPoolHelper.AcceptPooledConnection(IConnection connection, TimeoutHelper& timeoutHelper)
                at System.ServiceModel.Channels.ConnectionPoolHelper.EstablishConnection(TimeSpan timeout)
                at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.OnOpen(TimeSpan timeout)
                at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
                at Microsoft.ApplicationServer.Caching.CacheResolverChannel.Open(TimeSpan timeout)
                at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32

        ...

    looks there is security issue, could you anyone point out i need to do next?

    thanks.

    sanyorke

ตอบทั้งหมด

  • 27 มิถุนายน 2555 7:05
     
     

    Hi,

     Can you please paste the output of Get-CacheClusterHealth cmdlet in cache admin powershell and also the code snippet on how you're constructing the DataCacheFactory and DataCache ?

  • 27 มิถุนายน 2555 9:11
     
     คำตอบที่เสนอ

    thank you look at this question, here it is.

    PS C:\Windows\system32> Get-CacheClusterHealth

    Cluster health statistics
    =========================

    HostName = SZDODEV02.morningstar.com
    -------------------------

        NamedCache = Exp
            Healthy               = 34.38
            UnderReconfiguration  = 0.00
            NotPrimary            = 0.00
            InadequateSecondaries = 0.00
            Throttled             = 0.00


    HostName = SZDOLAB93.morningstar.com
    -------------------------

        NamedCache = Exp
            Healthy               = 31.25
            UnderReconfiguration  = 0.00
            NotPrimary            = 0.00
            InadequateSecondaries = 0.00
            Throttled             = 0.00


    HostName = SZDOLAB94.morningstar.com
    -------------------------

        NamedCache = Exp
            Healthy               = 34.38
            UnderReconfiguration  = 0.00
            NotPrimary            = 0.00
            InadequateSecondaries = 0.00
            Throttled             = 0.00

    Unallocated named cache fractions
    ---------------------------------

    i used the sample code from http://msdn.microsoft.com/en-us/library/hh351303

    here is a piece:

                //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("10.86.8.56", 22233));
                servers.Add(new DataCacheServerEndpoint("10.86.254.80", 22233));
                servers.Add(new DataCacheServerEndpoint("10.86.254.103", 22233));

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

                //Set the cache host(s)
                configuration.Servers = servers;
     
                configuration.SecurityProperties = new DataCacheSecurity();
                configuration.ChannelOpenTimeout = new TimeSpan(0, 2, 0);
                configuration.RequestTimeout = new TimeSpan(0, 1, 0);

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

                //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 "Exp"
                myDefaultCache = myCacheFactory.GetCache("Exp");

    ///////////////////////////

    I config the caching service again, this time it still get that exception. but I found there is a settings of DataCacheServiceAccountType, when I try to set this to DomainAccount, it works well. like below:

    configuration.DataCacheServiceAccountType = DataCacheServiceAccountType.DomainAccount;

    the Appfabric looks not easy to setup, it take me much time to get it works.

    • เสนอเป็นคำตอบโดย Flame Angel 12 ตุลาคม 2555 21:58
    •