title: HttpWebRequest - The underlying connection was closed: An unexpected error occurred on a send
body: <p>I'm attempting to post JSON data to a web API and get the resulting json object back.  I'm using HttpWebRequest to post to an https address using basic authentication.  On the request.GetResponse() I'm getting an error of </p>
  
  <pre><code>The underlying connection was closed: An unexpected error occurred on a send.
  </code></pre>
  
  <p>and an inner exception of</p>
  
  <pre><code>Received an unexpected EOF or 0 bytes from the transport stream.
  </code></pre>
  
  <p>My test application is compiled against .NET 4.0   The application works on machines running 4.5, however fails to run on several machines running 4.0.  Upgrading to 4.5 on those machines is not a simple task.  While pouring through the trace log, I've noticed only 1 difference before the failure occurs which I've included below.  Any help would be appreciated.</p>
  
  <pre><code>System.Net Information: 0 : [5876] ConnectStream#9956401 - Sending headers
  {
  Content-Type: application/json
  Authorization: Basic &lt;encoded base64 auth string is here&gt;
  Host: &lt;host name is here&gt;
  Content-Length: 130
  Expect: 100-continue
  Connection: Keep-Alive
  }.
  </code></pre>
  
  <p>While trying to research this error, I came across two recurring issues, neither of which seem to apply to my error, but I tried the fixes anyway.  I've tried forcing SSL3 (though authentication isn't the issue) and also turning off Keep-Alive.  Neither work.</p>