asp.net-mvc-3 - Azure AppFabric 缓存。错误代码<ERRCA0017> :SubStatus<ES0006>

标签 asp.net-mvc-3 azure appfabric appfabric-cache

发生了一件非常奇怪的事情
我有一个用 MVC 3 制作的网站,部署在 Azure WebRole 中
它运行良好,最初是在 VS2010 中制作的
现在我使用VS2012
我决定做一些小的改变,它似乎有效,但总是以随机的间隔崩溃
这就是正在发生的事情

随机间隔后我收到此错误 ErrorCode<ERRCA0017>:SubStatus<ES0006>
收到此错误 2-3 分钟后,网站似乎工作正常

我没有对网站之前版本中与缓存相关的任何内容进行更改
当我在 staging 中测试它时,不会发生此错误或在 local environment
我的代码中没有任何地方以编程方式访问此缓存
我已经复制粘贴了来自 azure 门户的整个配置,并且我知道它是正确的,因为这些配置设置与之前的配置设置相同
我只是使用 Azure AppFabric Caching因为我需要保存sessions一些地方。所以唯一提到它的地方是在我的网站 web config正如我所说,所有配置都可以假设是正确的。

这是堆栈跟踪,如果这可以有一些帮助

[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.)]
   Microsoft.ApplicationServer.Caching.DataCache.ThrowException(ResponseBody respBody) +616
   Microsoft.ApplicationServer.Caching.DataCache.ExecuteAPI(RequestBody reqMsg, IMonitoringListener listener) +29
   Microsoft.ApplicationServer.Caching.DataCache.InternalGetAndLock(String key, TimeSpan timeout, DataCacheLockHandle& lockHandle, String region, Boolean lockKey, IMonitoringListener listener) +227
   Microsoft.ApplicationServer.Caching.<>c__DisplayClass78.<GetAndLock>b__77() +103
   Microsoft.ApplicationServer.Caching.DataCache.GetAndLock(String key, TimeSpan timeout, DataCacheLockHandle& lockHandle) +258
   Microsoft.Web.DistributedCache.<>c__DisplayClass31`1.<PerformCacheOperation>b__30() +19
   Microsoft.Web.DistributedCache.DataCacheRetryWrapper.PerformCacheOperation(Action action) +208
   Microsoft.Web.DistributedCache.DataCacheForwarderBase.GetAndLock(String key, TimeSpan timeout, DataCacheLockHandle& lockHandle) +190
   Microsoft.Web.DistributedCache.BlobBasedSessionStoreProvider.GetItem(HttpContextBase context, String id, Boolean acquireWriteLock, Boolean& locked, TimeSpan& lockAge, Object& lockId, SessionStateActions& actions) +593
   Microsoft.Web.DistributedCache.DistributedCacheSessionStateStoreProvider.GetItemExclusive(HttpContext context, String id, Boolean& locked, TimeSpan& lockAge, Object& lockId, SessionStateActions& actions) +125
   System.Web.SessionState.SessionStateModule.GetSessionStateItem() +178
   System.Web.SessionState.SessionStateModule.BeginAcquireState(Object source, EventArgs e, AsyncCallback cb, Object extraData) +1076
   System.Web.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +115
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +375

更新:-
突然我发现了一个新错误,在我看来,这是许多网站谈论的内部错误之一
错误描述

A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond [IP-Address]:[PORT]


这是新的堆栈跟踪

[SocketException (0x274c): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond [IP-ADDRESS]:[PORT]]
   System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) +305
   System.Net.Sockets.Socket.Connect(EndPoint remoteEP) +162
   System.ServiceModel.Channels.SocketConnectionInitiator.Connect(Uri uri, TimeSpan timeout) +774

[EndpointNotFoundException: Could not connect to [SOCKET-ENDPOINT]. The connection attempt lasted for a time span of 00:00:21.0308462. TCP error code 10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 111.221.89.111:22233. ]
   System.Runtime.Remoting.Proxies.RealProxy.EndInvokeHelper(Message reqMsg, Boolean bProxyCase) +518
   System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(Object NotUsed, MessageData& msgData) +401
   Microsoft.ApplicationServer.Caching.OpenDelegate.EndInvoke(IAsyncResult result) +0
   Microsoft.ApplicationServer.Caching.ChannelContainer.Opened(IAsyncResult ar) +122

最佳答案

一年多前有一篇关于此错误的有趣博客文章:Azure AppFabric Caching - ErrorCode:SubStatus : What to do? .

Before intializing the DataCacheFactory modify the DataCacheFactoryConfiguration.ChannelOpenTimeout of the dataCacheFactoryConfiguration instance that you are using to a larger value of 2 minutes. (can't use configuration to set the value, since 20 seconds in the allowed limit) . Also, this recommendation is only for debugging purposes and ideally should not be needed in production environments. This lets the underlying layer to respond back with the actual error that occurred. Now, if you check the inner exception, you should see what caused the request to fail.

请按照以下步骤查找内部异常,这将解释请求失败的原因。

注意:如果这是由 transient 故障引起的,您应该考虑使用 Transient Fault Handling Application Block (还支持 AppFabric 缓存)以实现重试策略。

关于asp.net-mvc-3 - Azure AppFabric 缓存。错误代码<ERRCA0017> :SubStatus<ES0006>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12563690/

相关文章:

javascript - 我如何更新我的 MVC 3 站点中的图像?

c# - EWS 无法在 Windows Azure 上运行

azure - 将文件上传到 Azure BLOB 存储 - Parallel.Foreach 比 Foreach 慢

asp.net-mvc - @Html.ValidationSummary 是否适用于 MVC3 或 MVC4 中的客户端验证?

asp.net-mvc - ASP.NET MVC 3 变化总结

configuration - AppFabric DataCacheFactory 配置设置的适当值?

.net - Windows AppFabric 到底是什么?

c# - Best-practice caching : monolithic vs. 细粒度缓存数据

jQuery 选择同级

mysql - 连接字符串不正确。请访问门户网站以获取引用