title: File upload form with MVC4 Web-API: Getting Error 101 (net::ERR_CONNECTION_RESET): The connection was reset. Error
body: <p>I'm getting a webpage not available error when trying to access a controller action in an MVC4 Web-API app with VS2010.  I am trying to upload a small sized (less than 1MB) pdf document, create a byte[] to pass on to another service.  However, I can't get into either my normal controller or my api controller.  My app works and all views/partials/etc. show up fine except for this one (the page with the file upload form).  This view is a strongly typed partial.</p>
  
  <p>I've tried using the method shown here: <a href="https://stackoverflow.com/questions/13074791/upload-a-file-mvc-4-web-api-net-4">Upload a file MVC 4 Web API .NET 4</a> as well as here: <a href="http://blogs.msdn.com/b/henrikn/archive/2012/03/01/file-upload-and-asp-net-web-api.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/b/henrikn/archive/2012/03/01/file-upload-and-asp-net-web-api.aspx</a> and both of them don't work because my action attribute can't find my action.  Whether I put api/Documents or Home/api/Documents it won't work.  So i gave up and went back to my html helper beginform, hoping it would find it that way...but it didn't.  So after giving up on the fancy web-api stuff (couldn't get async to work), I figured I'd just go old school and pass in the file through a form, but I get the same error.  I've also tried re-creating the page, adjusting my httphandlers, runtime adjustments, routes and apiroutes, and am completely at a loss.  Please help!</p>
  
  <p>My UI:</p>
  
  <p><img src="https://i.stack.imgur.com/epMsW.png" alt="form with url">
  My Error:
  <img src="https://i.stack.imgur.com/OSw0s.png" alt="Error"></p>
  
  <p>My form:</p>
  
  <pre><code>    &lt;div class="tab-pane" id="addDoc"&gt;
          @using (Html.BeginForm("AddDocument", "Documents", FormMethod.Post, new { @class = "form-horizontal", @enctype = "multipart/form-data" }))
          {
              &lt;label class="control-label" for="newFile"&gt;Upload : &lt;/label&gt;
              &lt;input name="newFile" type="file" /&gt;
              &lt;input type="submit" value="Submit" class="btn btn-success"/&gt;
          }
      &lt;/div&gt;
  </code></pre>
  
  <p>My API controller:
  I know this doesn't make sense, but i have a breakpoint to just see if it even gets here, which it doesn't...</p>
  
  <pre><code>    [HttpPost]
      public AddDocumentResponse AddDocument(HttpPostedFileBase newFile)
      {
          AddDocumentResponse response = new AddDocumentResponse();
          return response;
      }
  </code></pre>
  
  <p>My normal controller Action:</p>
  
  <pre><code>    [HttpPost]
      public ActionResult AddDocument(HttpPostedFileBase newFile)
      {
          return View("DevNotes");
      }
  </code></pre>
  
  <p>My WebApiConfig:</p>
  
  <pre><code>    public static void Register(HttpConfiguration config)
      {
          config.Routes.MapHttpRoute(
              name: "DefaultApi",
              routeTemplate: "Home/api/{controller}/{id}",
              defaults: new { id = RouteParameter.Optional }
          );
      }
  </code></pre>
  
  <p>My RouteConfig:</p>
  
  <pre><code>    public static void RegisterRoutes(RouteCollection routes)
      {
          routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
  
          routes.MapRoute(
              name: "Default",
              url: "{controller}/{action}/{id}",
              defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
          );
  
          routes.MapRoute(
              name: "Default2",
              url: "Home/{controller}/{action}/{id}",
              defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
          );
      }
  </code></pre>
  
  <p>Part of My WebConfig:</p>
  
  <pre><code>    &lt;httpHandlers&gt;
         &lt;add path="*.less" verb="GET" type="dotless.Core.LessCssHttpHandler, dotless.Core" /&gt;
      &lt;/httpHandlers&gt;
      &lt;httpRuntime executionTimeout="99009" maxRequestLength="2097151"/&gt;
  </code></pre>