问题
I got lots of errors like No connection could be made because the target machine actively refused it 70.37.127.112:443
So I add Microsoft.Practices.TransientFaultHandling
to retry.
But still, lots of errors (even after retry)
I like to know:
1st, since Azure is a distributed service, why am I always reach 70.37.127.112 ( I access storage by simple original DefaultEndpointsProtocol=https;AccountName=storage_account;.....,
then use tableContext.CreateQuery<datatype>("table_name");
). I noticed all my tables (even in different Storage account) all hit 70.37.127.112. My question, is there a way to change it?
2nd, how to eliminate the error above totally?
error details
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)
回答1:
About your first question, the Azure Fabric Controller is in charge of allocating resources. When you request a service instance (e.g. Azure Storage) it will find an available server that will be in charge of dealing with the requests. This server may be in charge of different service instances, either yours or other people's, since Azure is a shared environment.
You can use affinity groups, as explained by Nuno Godinho, to have a finer degree of control on how the Fabric Controller will provision your services (e.g. in the same cluster or in different clusters).
See Inside Windows Azure storage: what's new and under the hood deep dive for a explanation on the architecture.
About the second question, on eliminating the error, I noticed that the port being refused is 443. It has happened to me before that this port was being blocked by a firewall or proxy on my own network. Please check if this is the case and have it opened.
If you're sure that your traffic can reach the remote server, the next best course of action is to open a support ticket with Windows Azure's support group. In my experience, they're quick and efficient.
For that, go to Support options for Windows Azure and choose Customer Support | Windows Azure.
来源:https://stackoverflow.com/questions/9859286/azure-table-storage-how-to-avoid-connection-error-i-tried-retry