2014-07-17 34 views
0

我試着去訪問MS Azure的緩存服務和漂亮的時候,我得到這個錯誤:Azure的緩存錯誤代碼<ERRCA0017>:子狀態<ES0006>

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://remoto.cache.windows.net: line 23233. 
    at Microsoft.ApplicationServer.Caching.DataCache.ThrowException(ErrStatus errStatus, Guid trackingId, Exception responseException, Byte[][] payload, EndpointID destination) 
    at Microsoft.ApplicationServer.Caching.SocketClientProtocol.Get(String key, ref DataCacheItemVersion version, ref TimeSpan timeout, ref ErrStatus err, String region, IMonitoringListener listener) 
    at Microsoft.ApplicationServer.Caching.DataCache.InternalGet(String key, ref DataCacheItemVersion version, String region, IMonitoringListener listener) 
    at Microsoft.ApplicationServer.Caching.DataCache.<>c__DisplayClass53.<Get>b__52() 
    at Infrastructure.Azure.Cache.AzureCacheServiceClient.<>c__DisplayClass6`1.<Get>b__5() in AzureCacheServiceClient.cs: line 88 
    at Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling.RetryPolicy.ExecuteAction(Func`1 func) 

當我試着去訪問某些對象緩存這樣它發生:

public T Get<T>(string key) 
{ 
    retryPolicy.ExecuteAction(() =>(T) (_cache.Get(key))); 
} 

這裏是我的初始化代碼:

var cacheFactory = new DataCacheFactory(); 
_cache = cacheFactory.GetDefaultCache(); 

var retryStrategy = new FixedInterval(15, TimeSpan.FromSeconds(2)); 
_retryPolicy = new RetryPolicy<CustomCacheTransientErrorDetectionStrategy>(retryStrategy); 

的app.config:

<configSections> 
    <section name="dataCacheClients" type="Microsoft.ApplicationServer.Caching.DataCacheClientsSection, Microsoft.ApplicationServer.Caching.Core" allowLocation="true" allowDefinition="Everywhere" /> 
    <section name="cacheDiagnostics" type="Microsoft.ApplicationServer.Caching.AzureCommon.DiagnosticsConfigurationSection, Microsoft.ApplicationServer.Caching.AzureCommon" allowLocation="true" allowDefinition="Everywhere" /> 
</configSections> 

<dataCacheClients> 
    <dataCacheClient channelOpenTimeout="1000" requestTimeout="45000" name="default"> 
     <autoDiscover isEnabled="true" identifier="[some.host.name]" /> 

     <securityProperties mode="Message" sslEnabled="true"> 
     <messageSecurity authorizationInfo="***" /> 
     </securityProperties> 
    </dataCacheClient> 
</dataCacheClients> 

它的發生已經至少三次,而Azure的健康狀況(https://azure.microsoft.com/en-us/status/)所說的一切在當時的罰款。 正如異常消息所說 - MS端存在一些「臨時」故障,也許我在代碼中做錯了?

+0

你解決了這個問題,因爲我面臨着同樣的問題。 – loop

回答

1

你是否得到錯誤幾次,然後事情又開始工作?如果是這樣,這是預期的行爲,並且您的應用程序應該有一個策略,在您重新嘗試某些次數之前回退到持久數據存儲區。

如果您一直得到錯誤(超過幾秒鐘),那麼DataCacheFactory可能已經進入了一個不良狀態。您可以重新啓動客戶端進程,也可以按照此blog post中所述刷新DataCacheFactory。