Randomly getting "System.Net.Sockets.SocketException: A connection attempt failed because the connected party

1

I have Created a webjob to crawl my website on Azure which runs in every 10 seconds, the webjob is working fine few months before but now randomly i am getting the below error

System.Net.Sockets.SocketException (0x80004005): 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 81.218.113.171: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, Exception& exception)

I have tried to google it and tried many methods to set on WebRequest as stated below

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

As I am saying the error comes randomly, On crawling 5 to 6 times it comes for once.

c#
.net
azure
asked on Stack Overflow Jul 5, 2018 by DevProf

2 Answers

1

Maybe the reason is :

  • Check firewall settings on production server
  • Check whether IP white listing is required
  • Antivirus might be blocking the request
  • If no luck, install Advanced REST Client tool on Chrome and manually test the request
answered on Stack Overflow Jul 5, 2018 by Aakash Singh
1

How many instances of your web site are running? It's possible there are (say) 6 instances running, where 5 of them are OK, but the last has stopped running. The load-balancer doesn't realise the instance is down and is still pushing requests to the 'broken' instance.

answered on Stack Overflow Jul 5, 2018 by Neil

User contributions licensed under CC BY-SA 3.0