title: IOException reading from HttpWebResponse response stream over SSL
body: <p>I get the following exception when attempting to read the response from my HttpWebRequest:</p>
  
  <pre><code>System.IO.IOException: Received an unexpected EOF or 0 bytes from the transport stream.
     at System.Net.ConnectStream.Read(Byte[] buffer, Int32 offset, Int32 size)
     at System.IO.StreamReader.ReadBuffer()
     at System.IO.StreamReader.ReadToEnd()
     ...
  </code></pre>
  
  <p>My code functions without issue when using http.</p>
  
  <p>I am talking to a third-party device; I do not have access to the server code.</p>
  
  <p>My code is as follows:</p>
  
  <pre><code>private string MakeRequest() {
     // Disable SSL certificate verification per
     // http://www.thejoyofcode.com/WCF_Could_not_establish_trust_relationship_for_the_SSL_TLS_secure_channel_with_authority.aspx
     ServicePointManager.ServerCertificateValidationCallback =
          new RemoteCertificateValidationCallback(delegate { return true; });
  
      Uri uri = new Uri("https://mydevice/mypath");
      HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
      request.Method = WebRequestMethods.Http.Get;
  
      using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) {
          using (Stream responseStream = response.GetResponseStream()) {
              using (StreamReader sr = new StreamReader(responseStream.)) {
                  return sr.ReadToEnd();
              }
          }
      }
  }
  </code></pre>
  
  <p>Does anybody have any thoughts about what might be causing it?</p>