I have an application that makes a sync request on an external resource via http(s). Every few weeks I get the following exception
Exception: System.Net.WebException - Message: Unable to connect to the remote server
Inner Exception: System.Net.Sockets.SocketException - Message: 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
What is bothering me is that my trace logs show that for every single instance of this exception, it was thrown "21 seconds" into the request.
Has anybody seen behaviour like this before and is there a solution? Are there any known issues within the System.Net.HttpWebRequest namespace? What are the best practices for using System.Net.HttpWebRequest e.g. should I explicitly close and dispose of response streams...