title: System.Net.WebException: The operation has timed out at System.Net.HttpWebRequest.GetResponse()
body: <p>I'm trying to get some help. I have a vendor that posts data to us and keep receiving this error...</p>
  
  <pre><code>System.Net.WebException: The operation has timed out
     at System.Net.HttpWebRequest.GetResponse()
     at WindowsService1.KUEcampus_PMpost.timer1_Elapsed(Object sender, ElapsedEventArgs e) 
  </code></pre>
  
  <p>I have read on a few forums that this is from a bug on the .net plattform and to make the keepalive = false but that didn't seem to work. Below is the code and the trace and the response from the trace. Can someone please help this is sooo out of my realm. I am not an asp.net programmer but I really need to get this resolved.</p>
  
  <pre><code>   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);
  </code></pre>
  
  <p>Log trace:</p>
  
  <pre><code>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&amp;status=&amp;leadid=6470196&amp;disposition=EINITIAL&amp;activitydatetime=12/18/2014%202:49:05%20PM&amp;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&amp;status=&amp;leadid=6470197&amp;disposition=EINITIAL&amp;activitydatetime=12/18/2014%202:49:07%20PM&amp;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
  </code></pre>