title: .NET MVC3 - long POST request results in 404 on IIS7
body: <p>I have a problem with my form posting data in MVC3. Locally, the form POSTs successfully but on the live server when there is a lot of post data a 404 is displayed rather than the success page. The data comes from the Model that gets included in the POST, there's often a lot of data in there, some of which I am using. I've looked at changing the settings in the web.config but this hasn't helped. Here are some snippets of my code:</p>
  
  <p>The View:</p>
  
  <pre><code> @using (Html.BeginForm("Bookmarked", "Bookmarklet", Model, FormMethod.Post))
  {
  
  &lt;div class="form"&gt;
  @Html.ValidationSummary(false)
  
   @Html.TextBoxFor(a =&gt; a.Url, new { @class = "hidden" })
   @Html.TextBoxFor(a =&gt; a.SelectedImage, new { @class = "selected-image hidden" })
  
   &lt;div class="form-left"&gt;
      &lt;div class="row"&gt;
          &lt;label&gt;
              Name:
          &lt;/label&gt;
          @Html.TextBoxFor(a =&gt; a.Name, new { @class = "textbox" })
          @Html.ValidationMessageFor(a =&gt; a.Name, null, new { style = "display:none" })
      &lt;/div&gt;
  
      &lt;div class="row"&gt;
          &lt;label&gt;
              Tags:
          &lt;/label&gt;
          @Html.TextBoxFor(a =&gt; a.Tags, new { @class = "textbox tb-tags", @placeholder = "", onKeyUp = "submitForm(event)" })
  
      &lt;/div&gt;
  
      &lt;div class="row"&gt;
          &lt;br /&gt;
          &lt;label&gt;
              &amp;nbsp;&lt;/label&gt;&lt;a href="javascript:document.forms[0].submit()" class="button fl"&gt;&lt;span&gt;Bookmark&lt;/span&gt;&lt;/a&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  
  // The controller
  
  [HttpPost]
      public ActionResult Bookmarked(BookmarkModel initialState, BookmarkModel model)
      {
          try
          {
              HttpCookie cookie = Request.Cookies["UserGuid"];
              HttpCookie cookie2 = Request.Cookies["Username"];
              if (cookie != null &amp;&amp; cookie2 != null)
              {
                 //do stuff with model data received from the View that the POST comes from
  
                 da.Save(model.Name, cookie.Value);
                  return View();
               }
                else
                      throw new Exception("Error saving, please try again");
  
          }
          catch (Exception ex)
          {
              ModelState.AddModelError("", ex.Message);
              return Bookmark(model);
          }
  
      }
  
  // web.config
  
   &lt;system.web&gt;
   &lt;httpRuntime maxUrlLength="10999" maxQueryStringLength="2097151" /&gt;
   &lt;compilation debug="true" targetFramework="4.0"&gt;
    &lt;assemblies&gt;
      &lt;add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /&gt;
      &lt;add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /&gt;
      &lt;add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /&gt;
      &lt;add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /&gt;
      &lt;add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /&gt;
    &lt;/assemblies&gt;
  &lt;/compilation&gt;
  
  &lt;authentication mode="Forms"&gt;
    &lt;forms loginUrl="~/Account/LogOn" timeout="2880" /&gt;
  &lt;/authentication&gt;
  
  &lt;pages&gt;
    &lt;namespaces&gt;
      &lt;add namespace="System.Web.Helpers" /&gt;
      &lt;add namespace="System.Web.Mvc" /&gt;
      &lt;add namespace="System.Web.Mvc.Ajax" /&gt;
      &lt;add namespace="System.Web.Mvc.Html" /&gt;
      &lt;add namespace="System.Web.Routing" /&gt;
      &lt;add namespace="System.Web.WebPages"/&gt;
      &lt;add namespace="ConsumerMVC3.App_Code"/&gt;
    &lt;/namespaces&gt;
    &lt;/pages&gt;
  &lt;/system.web&gt;
  
  &lt;system.webServer&gt;
    &lt;validation validateIntegratedModeConfiguration="false"/&gt;
    &lt;modules runAllManagedModulesForAllRequests="true"/&gt;
    &lt;security&gt;
       &lt;requestFiltering&gt;
        &lt;requestLimits maxAllowedContentLength="2147483648" /&gt;
      &lt;/requestFiltering&gt;
    &lt;/security&gt;
  &lt;/system.webServer&gt;
  </code></pre>
  
  <p>Can anyone give me some suggestions?</p>
  
  <p>Thanks,
  Colin</p>