title: "An existing connection was forcibly closed by the remote host" error in IIS, but not VS dev server
body: <p>Through my application, I'm using <code>WebClient</code> to access files online and processing them.  Here is one such example:</p>
  
  <pre><code>using (var webClient = new WebClient())
  {
      webClient.Credentials = new NetworkCredential(userName, password, domain);
      var bytes = webClient.DownloadData(urlToWorkbook);
      Stream stream = new MemoryStream(bytes);
      var workbook = new Workbook(stream);
      stream.Close();
      stream.Dispose();
      return workbook;
  }
  </code></pre>
  
  <p>When I was developing the application and testing through Visual Studio's debugger, everything worked fine.  Now that I've deployed the application and it's running through IIS, I get the following error on the <code>webClient.DownloadData()</code> call:</p>
  
  <p><code>System.Net.WebException: An exception occurred during a WebClient request. System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---&gt; System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)</code></p>
  
  <p>EDIT: Another strange thing is that when I put this code on my controller's Index action (this is an MVC) app, it executes the DownloadData() call successfully everything.  It is only when the call is embedded in my application (where it's needed) that it fails.</p>
  
  <p>I published my site locally to my machine's IIS and I get the same exception.  I feel like I've tried a million code solutions.  It would seem it's a difference between VS's web server and IIS.  Any idea of what I could do in IIS?</p>