title: Why is file uploading failing in ASP.Net MVC?
body: <p>I am uploading files using HttpWebRequest to an ASP.Net MVC application but, for some reason unknown to me, it is failing to upload consistently. </p>
  
  <p>I know the file is good since if you try enough times it does eventually upload and can be viewed on the server just fine. When it fails, neither the server nor client reports any errors directly related to the upload, the upload just stops partway through at a random location and time and my MVC action method is called without the file being loaded (<code>Request.Files.Count == 0</code>).</p>
  
  <p>This only seems to be a problem in our production environment over DSL. The test and development environment works fine and the production environment works fine from in the office (really fast connection to servers) but fails when running it from home over DSL.</p>
  
  <p>As you can see below, the point where it fails is pretty basic.</p>
  
  <pre><code>[Authorize]
  [AcceptVerbs(HttpVerbs.Put | HttpVerbs.Post)]
  [ValidateInput(false)]
  public int UploadScene(int sceneID, int tourID, string name, int number, PhotoType photoType)
  {
      SceneInfo scene;
      if (Request.Files.Count &lt; 1) throw new InvalidOperationException("Image file not uploaded.");
      // process file...
  }
  </code></pre>
  
  <p>It seems that it is probably configuration, but I can't figure what it might be. We are running in a cluster (we have 4 web servers) so it might have something to do with that, but I am testing against a single server (I can isolate the machine by name and can verify that it is processing my requests). I have also made sure that it is running in it's own app pool. What else should I check?</p>
  
  <p>We are using IIS6 and .Net 3.5 on the servers.</p>