4

因此,我遇到了许多用户遇到的相同错误-

> Home Page. Modify this template to jump-start your ASP.NET MVC
> application.Microsoft.ApplicationServer.Caching.DataCacheException:
> 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.). Additional Information : The client was trying
> to communicate with the server:
> net.tcp://hamzacachetrial.cache.windows.net:24233. at
> Microsoft.ApplicationServer.Caching.DataCache.ThrowException(ErrStatus
> errStatus, Guid trackingId, Exception responseException, Byte[][]
> payload, EndpointID destination) at
> Microsoft.ApplicationServer.Caching.DataCache.ThrowException(ResponseBody
> respBody, EndpointID destination) at
> Microsoft.ApplicationServer.Caching.DataCacheFactory.EstablishConnection(IEnumerable`1
> servers, RequestBody request, Func`3 sendMessageDelegate,
> DataCacheReadyRetryPolicy retryPolicy) at
> Microsoft.ApplicationServer.Caching.SocketClientProtocol.<>c__DisplayClass5.<Initialize>b__2(RequestBody
> req) at
> Microsoft.ApplicationServer.Caching.SocketClientProtocol.SendReceive(IVelocityRequestPacket
> request, Func`2 delegate, EndpointID& destination) at
> Microsoft.ApplicationServer.Caching.SocketClientProtocol.Initialize(IEnumerable`1
> servers) at
> Microsoft.ApplicationServer.Caching.DataCacheFactory.GetCache(String
> cacheName, CreateNewCacheDelegate cacheCreationDelegate,
> DataCacheInitializationViaCopyDelegate initializeDelegate) at
> Microsoft.ApplicationServer.Caching.DataCacheFactory.GetCache(String
> cacheName) at MvcWebRole1.Controllers.HomeController.Index() in
> c:\Users\hk7654\Documents\Visual Studio
> 2012\Projects\CacheTrial\MvcWebRole1\Controllers\HomeController.cs:line
> 46

这是我的功能-

`public ActionResult Index()
    {
        var retryStrategy = new FixedInterval(5, TimeSpan.FromSeconds(60));
        var retryPolicy = new RetryPolicy<CacheTransientErrorDetectionStrategy>(retryStrategy);
        DataCache cache = null;

        retryPolicy.Retrying += (sender1, args) =>
        {
            var msg = String.Format("Retry - Count:{0}, Delay:{1}, Exception:{2}",
                args.CurrentRetryCount, args.Delay, args.LastException);
            Trace.Write(msg);
        };

        try
        {
             DataCacheFactoryConfiguration config = new DataCacheFactoryConfiguration();
             config.TransportProperties.ReceiveTimeout = new TimeSpan(45000);
             config.ChannelOpenTimeout = new TimeSpan(150000);

             DataCacheFactory cacheFactory = new DataCacheFactory(config);
             cache = cacheFactory.GetCache("default");

             retryPolicy.ExecuteAction(
             () =>
                {
                    cache.Add("name" + _i++, "hamza");

                });

         }
         catch (DataCacheException ex)
         {
              Trace.Write(ex.GetType().ToString() +  ex.Message.ToString()+ex.StackTrace.ToString());
         }

    }`

如某些解决方案中所述,我使用了瞬态故障处理以及 ChannelOpenTimeout 和 TransportProperties.ReceiveTimeout。这是 web 配置的 datacacheclient 部分 -

 <dataCacheClients>
<dataCacheClient name="default">

  <autoDiscover isEnabled="true" identifier="hamzacachetrial.cache.windows.net" />
  <securityProperties mode="Message" sslEnabled="false">
    <messageSecurity authorizationInfo="XXXXXXXXXX" />
  </securityProperties>
</dataCacheClient>

这里似乎也没有错。

当我使用角色缓存时,我没有遇到这样的问题,但是专用缓存服务不起作用。缓存是标准 4GB 缓存,我也尝试过使用基本的 128 MB 缓存。我需要知道的另一件事是 ClientPerfCounters 是否必要?他们不应该只是为了确定。我知道很多人都问过这个问题,但没有一个解决方案对我有用。请帮忙!!!

4

0 回答 0