我有这段代码:
string StreamUrl = _DestinationStreamUrl + "/" + gLoginString + "/"
+ Command + "?http," + StreamParam + ",csv&winmob=" +
ClassGlobalClass.VersioneJack;
Uri uri = new Uri(StreamUrl);
HttpWebRequest httpRequest = (HttpWebRequest)HttpWebRequest.Create(uri);
httpRequest.Timeout = 60000;
httpRequest.KeepAlive = false;
if (SendHeader != null)
{
httpRequest.Headers.Add("X", SendHeader);
}
HttpWebResponse httpResponse = (HttpWebResponse)httpRequest.GetResponse();
StreamReader reader = new StreamReader(httpResponse.GetResponseStream());
Result = reader.ReadToEnd();
httpRequest.Abort();
httpResponse.Close();
reader.Close();
服务器在3秒后从客户端收到一个关闭连接,但是在我的代码中我没有这个..并且我在60秒后在GetResponse上收到TimeOut异常。
感谢。