System.Net.WebException:操作已在System.Net.HttpWebRequest.GetResponse()超时

时间:2014-12-19 06:15:23

标签: c# asp.net posting

我正在努力寻求帮助。我有一个供应商向我们发布数据并继续收到此错误...

System.Net.WebException: The operation has timed out
   at System.Net.HttpWebRequest.GetResponse()
   at WindowsService1.KUEcampus_PMpost.timer1_Elapsed(Object sender, ElapsedEventArgs e) 

我在一些论坛上看到这是来自.net平台上的一个错误,并使keepalive = false,但似乎没有用。下面是代码和跟踪以及跟踪的响应。有人可以请求帮助这是我的境界。我不是asp.net程序员,但我真的需要解决这个问题。

   HttpWebRequest objRequest;
   objRequest = (HttpWebRequest)WebRequest.Create(sUrl);
   objRequest.KeepAlive = false;
   objRequest.ProtocolVersion = HttpVersion.Version10; 
   objRequest.Timeout = -1;
   objRequest.Method = "POST";
   objRequest.ContentLength = strPost.Length;
   objRequest.ContentType = "application/x-www-form-urlencoded";
   StreamWriter myWriter 
      = new StreamWriter(objRequest.GetRequestStream(), Encoding.ASCII);                                   
   myWriter.Write(strPost);

记录跟踪:

Log Entry : 2:48:33 PM Thursday, December 18, 2014
  :
  :Timer Complete
-------------------------------

Log Entry : 2:53:33 PM Thursday, December 18, 2014
  :
  :Timer Fired
-------------------------------

Log Entry : 2:53:51 PM Thursday, December 18, 2014
  :
  :Getting history record 28613292
-------------------------------

Log Entry : 2:53:51 PM Thursday, December 18, 2014
  :
  :Getting WebRequest
-------------------------------

Log Entry : 2:53:52 PM Thursday, December 18, 2014
  :
  :ProspectManager Posted Data: form=CARS&status=&leadid=6470196&disposition=EINITIAL&activitydatetime=12/18/2014%202:49:05%20PM&survcode=KUPSLNET
-------------------------------

Log Entry : 2:53:57 PM Thursday, December 18, 2014
  :
  :System.Net.WebException: The underlying connection was closed: The connection was closed unexpectedly.
   at System.Net.HttpWebRequest.GetResponse()
   at WindowsService1.KUEcampus_PMpost.timer1_Elapsed(Object sender, ElapsedEventArgs e)
-------------------------------

Log Entry : 2:53:57 PM Thursday, December 18, 2014
  :
  :   at System.Net.HttpWebRequest.GetResponse()
   at WindowsService1.KUEcampus_PMpost.timer1_Elapsed(Object sender, ElapsedEventArgs e)
-------------------------------

Log Entry : 2:53:57 PM Thursday, December 18, 2014
  :
  :The underlying connection was closed: The connection was closed unexpectedly.
-------------------------------

Log Entry : 2:53:57 PM Thursday, December 18, 2014
  :
  :Getting history record 28613293
-------------------------------

Log Entry : 2:53:57 PM Thursday, December 18, 2014
  :
  :Getting WebRequest
-------------------------------

Log Entry : 2:53:57 PM Thursday, December 18, 2014
  :
  :ProspectManager Posted Data: form=CARS&status=&leadid=6470197&disposition=EINITIAL&activitydatetime=12/18/2014%202:49:07%20PM&survcode=KUPSLNET
-------------------------------

Log Entry : 2:54:00 PM Thursday, December 18, 2014
  :
  :Post to ProspectManager 2014/12/18 14:53
-------------------------------

Log Entry : 2:54:00 PM Thursday, December 18, 2014
  :
  :SUCCESS

0 个答案:

没有答案