昨天我能够向HTTP设备发送GET
个请求:
string urlString = "http://192.168.1.100/........."
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(urlString);
request.Timeout = 1000;
request.Credentials = new NetworkCredential("the_login_name", "the_password");
request.GetResponse().Close();
但今天这些请求超时,好像设备的主机已关闭,虽然我可以从浏览器手动发送这些请求,但设备会立即响应。
HttpWebRequest
可能会发生什么?
答案 0 :(得分:2)
request.ServicePoint.ConnectionLeaseTimeout = 5000;
request.ServicePoint.MaxIdleTime = 5000;