随机获取"System.Net.Sockets.SocketException:连接尝试失败,因为连接的一方



我创建了一个网络作业来在 Azure 上爬网我的网站,每 10 秒运行一次,网络作业在几个月前工作正常,但现在随机我收到以下错误

System.Net.Sockets.SocketException (0x80004005(:连接尝试 失败,因为连接方在 时间段,或建立的连接因连接而失败 主机无法响应 81.218.113.171:443 at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, 套接字地址套接字地址( 在 System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket&socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& 例外(

我尝试过谷歌搜索它,并尝试了许多方法来设置WebRequest如下所述

WebRequest.proxy = null;
WebRequest.KeepAlive = false;
WebRequest.ProtocolVersion = HttpVersion.Version10;
WebRequest.ServicePoint.ConnectionLimit = 12;

正如我所说,错误是随机出现的,在爬行 5 到 6 次时,它会出现一次。

您的网站有多少个实例正在运行? 可能有(比如(6 个实例正在运行,其中 5 个正常,但最后一个已停止运行。 负载均衡器没有意识到实例已关闭,但仍将请求推送到"损坏"的实例。

相关内容

最新更新