Can no one answer this question?
c# Why does System.net.WebException happen
Preconditions:
The code is as follows:
ServicePointManager.ServerCertificateValidationCallback += (s, cert, chain, sslPolicyErrors) => true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls | SecurityProtocolType.Ssl3;
using (WebClient client = new WebClient())
{
。。。。。。
IWebProxy proxy = Proxy.GetWebProxy(new Uri(address));
。。。。。。
byte[] resBytes = client.UploadValues(address, param);
}
abnormal:
The following fault occurs, but it does not occur every time it runs, it only occasionally occurs:
System.Net.WebException:
Connection disconnected: the connection that was needed to be cut was disconnected by the server.
-
system. Io.ioexception: unable to read data from a transfer connection: unable to connect because the connected caller did not respond correctly even after a certain period of time. The established connection failed because the connected host did not respond.
-
system. Net. Sockets. Socketexception: unable to connect because the connected caller did not respond correctly even after a certain period of time. The established connection failed because the connected host did not respond.
question:
What is the cause of the malfunction