Azure表存储,如何避免连接错误(我尝试重试)

本文关键字:重试 错误 连接 存储 何避免 Azure | 更新日期: 2023-09-27 18:29:01

我有很多错误,比如No connection could be made because the target machine actively refused it 70.37.127.112:443

所以我添加Microsoft.Practices.TransientFaultHandling以重试。

但是,仍然有很多错误(即使在重试之后)

我想知道:

首先,既然Azure是一个分布式服务,为什么我总是达到70.37.127.112(我通过简单的原始DefaultEndpointsProtocol=https;AccountName=storage_account;.....,访问存储,然后使用tableContext.CreateQuery<datatype>("table_name");)。我注意到我所有的表(甚至在不同的存储帐户中)都达到了70.37.127.112。我的问题是,有办法改变它吗?

第二,如何完全消除上述错误?

错误详细信息

System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 70.37.127.112:443
   at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)
   --- End of inner exception stack trace ---
   at System.Net.HttpWebRequest.GetResponse()
   at System.Data.Services.Client.QueryResult.Execute()
   at System.Data.Services.Client.DataServiceRequest.Execute[TElement](DataServiceContext context, QueryComponents queryComponents)
   at System.Data.Services.Client.DataServiceQuery`1.Execute()
   at System.Data.Services.Client.DataServiceQuery`1.GetEnumerator()
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at Microsoft.Practices.TransientFaultHandling.RetryPolicy.<>c__DisplayClass1.<ExecuteAction>b__0()
   at Microsoft.Practices.TransientFaultHandling.RetryPolicy.ExecuteAction[TResult](Func`1 func)

Azure表存储,如何避免连接错误(我尝试重试)

关于您的第一个问题,Azure结构控制器负责分配资源。当您请求服务实例(例如Azure Storage)时,它会找到一个负责处理请求的可用服务器。此服务器可能负责不同的服务实例,无论是您的还是其他人的,因为Azure是一个共享环境。

正如Nuno Godinho所解释的,您可以使用亲和组来更好地控制结构控制器将如何提供您的服务(例如,在同一集群或不同集群中)。

请参阅Inside Windows Azure storage:what’s new and under the hood deep depression以了解有关该体系结构的解释。

关于第二个问题,在消除错误时,我注意到被拒绝的端口是443。我以前也遇到过这个端口被我自己网络上的防火墙或代理阻止的情况。请检查是否是这种情况,并将其打开。

如果你确信你的流量可以到达远程服务器,那么下一个最好的做法是向Windows Azure的支持小组打开支持票证。根据我的经验,它们既快捷又高效。

为此,请转到Windows Azure的支持选项,然后选择客户支持|Windows Azure。