昨天我能够将GET
请求发送到HTTP设备:
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
可能会发生什么?
request.ServicePoint.ConnectionLeaseTimeout = 5000;
request.ServicePoint.MaxIdleTime = 5000;