我读了以下两条,并尝试执行。
我的法典是这样,现在到了此刻。
HttpWebRequest wr = (HttpWebRequest)WebRequest.Create(url);
wr.ContentType = "multipart/form-data; boundary=" + boundary;
wr.Method = "POST";
wr.KeepAlive = false;
wr.CookieContainer = cookieJar;
wr.Proxy = null;
wr.ServicePoint.ConnectionLeaseTimeout = 5000;
Stream rs = wr.GetRequestStream(); // -> Time out error occurs here
https://stackoverflow.com/questions/5827030/httpwebrequest-times-out-on-second-quest> 第一条改为。
My code using that as a sample
HttpWebRequest wr = (HttpWebRequest)WebRequest.Create(url);
wr.ContentType = "multipart/form-data; boundary=" + boundary;
wr.Method = "POST";
wr.KeepAlive = false;
wr.CookieContainer = cookieJar;
wr.Timeout = 5000;
wr.Proxy = null;
wr.ServicePoint.ConnectionLeaseTimeout = 5000;
wr.ServicePoint.MaxIdleTime = 5000;
Stream rs = wr.GetRequestStream(); //-->Time out error
任何杂货都是有益的。 我有时会收到1项请求,所有其他要求都失败或一切失败。 张贴到HTTPS站点。 Fiddler女士
UPDATE 1: I tried following zbugs ideas but that resulted in same issue. the first request goes through the subsequent ones fail. I am closing all response streams as well as calling abort on my request object.