title: ASP.NET / MVC 4 bundling and minification 404 issues on 64-bit IIS 7.5 server
body: <p>We recently upgraded our project from MVC 3  to MVC 4. We are targeting the .NET 4.0 framework, and our web app is 32-bit due to some references we have to include.</p>
  
  <p>The problem we are having is that we converted our bundling / minification from Chirpy to the built-in ASP.NET bundling. The site runs with no problems on 32-bit servers, both Windows Server 2003/IIS 6 and 2008/IIS 7.5 running ONLY .NET 4.0, and our 64-bit development machines.  The bundling / minification works fine on all of the above.</p>
  
  <p>On a 64-bit Windows 2008 / IIS 7.5 server with ONLY .NET 4.0 installed, bundling does not work. We get 404 errors for both the generated scripts and styles. </p>
  
  <p>If we install .NET 4.5 on the 64-bit server, it works fine. We are confused by this because some servers work without .NET 4.5, and this one requires it. On top of that, Windows Server 2003 / 64-bit is not compatible with .NET 4.5 so if that has an issue as well, this fix won't work.</p>
  
  <p>The weird thing is, the sample MVC 4 sample internet app targeting .NET 4.0 built x86 works fine with just 4.0 on the problem server. The web.config is exactly the same except for unity, logging, elmah, and dot less configuration.</p>
  
  <p>Any help with this would be much appreciated.</p>
  
  <p>Here's the BundleConfig.cs:</p>
  
  <pre><code>using System.Web;
  using System.Web.Optimization;
  
  namespace WebApp
  {
      public class BundleConfig
      {
          public static void RegisterBundles(BundleCollection bundles)
          {
              bundles.UseCdn = false;
  
              // .debug.js, -vsdoc.js and .intellisense.js files 
              // are in BundleTable.Bundles.IgnoreList by default.
              // Clear out the list and add back the ones we want to ignore.
              // Don't add back .debug.js.
              bundles.IgnoreList.Clear();
              bundles.IgnoreList.Ignore("*-vsdoc.js");
              bundles.IgnoreList.Ignore("*intellisense.js");
  
              bundles.Add((new ScriptBundle("~/bundles/WebApp.Register1")).Include("~/Scripts/jquery.ba-tinypubsub.min.js",       
                                                                                   "~/Scripts/knockout-2.1.0.js",
                                                                                   "~/Scripts/WebApp/WebApp.Register.RegisterStudent.js",
                                                                                   "~/Scripts/WebApp/WebApp.Register.RegisterPresenter.js"));
  
              bundles.Add((new Bundle("~/bundles/WebApp.Register2")).Include("~/Scripts/WebApp/WebApp.Register.StudentSelect.js"));
  
  
              bundles.Add((new ScriptBundle("~/bundles/WebApp.View1")).Include("~/Scripts/jquery.ba-tinypubsub.min.js",
                                                                               "~/Scripts/WebApp/WebApp.View.ImagePresenter.js", 
                                                                               "~/Scripts/WebApp/WebApp.View.ImageResults.js"));
  
              bundles.Add((new Bundle("~/bundles/WebApp.View2")).Include("~/Scripts/WebApp/WebApp.View.StudentsSelect.js"));
  
              bundles.Add((new ScriptBundle("~/bundles/WebApp.Print1")).Include("~/Scripts/WebApp/WebApp.Print.SelectedIdArray.js",
                                                                                "~/Scripts/jquery.ba-tinypubsub.min.js",
                                                                                "~/Scripts/WebApp/WebApp.Print.DocumentsSelect.js",
                                                                                "~/Scripts/WebApp/WebApp.Print.DocumentsSelected.js",
                                                                                "~/Scripts/WebApp/WebApp.Print.DocumentsPresenter.js",
                                                                                "~/Scripts/WebApp/WebApp.Print.StudentsPresenter.js",
                                                                                "~/Scripts/WebApp/WebApp.Print.PrinterSelected.js",
                                                                                "~/Scripts/WebApp/WebApp.Print.OutputSummary.js",
                                                                                "~/Scripts/WebApp/WebApp.Print.OutputPresenter.js",
                                                                                "~/Scripts/WebApp/WebApp.Print.NoStudentPresenter.js"));
  
              bundles.Add((new Bundle("~/bundles/WebApp.Print2")).Include("~/Scripts/WebApp/WebApp.Print.StudentsSelect.js",
                                                                          "~/Scripts/WebApp/WebApp.Print.StudentsSelected.js"));
  
              bundles.Add((new ScriptBundle("~/bundles/WebApp.Main")).Include("~/Scripts/modernizr.custom.33607.js", 
                                                                              "~/Scripts/jquery-1.6.1.js",
                                                                              "~/Scripts/jquery-ui-1.8.10.custom.min.js",
                                                                              "~/Scripts/jquery-ui.min.js", 
                                                                              "~/Scripts/json.js",
                                                                              "~/Scripts/jquery.validate.min.js", 
                                                                              "~/Scripts/jquery.marquee.js",
                                                                              "~/Scripts/YUI.js", 
                                                                              "~/Scripts/Common.SearchHighlight.js"));
  
              bundles.Add((new StyleBundle("~/bundles/Content/WebApp.Main")).Include("~/Content/jquery.marquee.min.css",
                                                                                        "~/Content/YUI.css", 
                                                                                        "~/Content/Site.css",
                                                                                        "~/Content/ui-lightness/jquery-ui-1.8.10.custom.css"));
          }
      }
  }
  </code></pre>
  
  <p>Here's how we're referencing the bundles in our layout:</p>
  
  <pre><code>    @Scripts.Render("~/bundles/WebApp.Main")
      &lt;link href="@Url.Content("~/Content/SiteLess.less")" rel="stylesheet" type="text/css"  /&gt;
      @Styles.Render("~/bundles/Content/WebApp.Main")
      ...
  </code></pre>
  
  <p>EDIT: Responses / updates</p>
  
  <ul>
  <li>Yes, the Enabled 32-bit apps flag is set to True in the app pool. </li>
  <li>The path to the request that gives the 404 looks like this <a href="http://xx.xx.xx.xxx/WebApp/bundles/WebApp.Main?v=03pBc7hdH1lHLtZGx-JMosNaLpMK7fcmI0uI6auknHw1" rel="nofollow">http://xx.xx.xx.xxx/WebApp/bundles/WebApp.Main?v=03pBc7hdH1lHLtZGx-JMosNaLpMK7fcmI0uI6auknHw1</a></li>
  <li>Windows event viewer shows nothing</li>
  <li>It works after installing .NET 4.5, uninstalling it, then reinstalling .NET 4.0</li>
  <li>It works on an enterprise 2008 64-bit Server. The problem server is standard edition. We are going to rebuild the VM to see if that fixes the issue.</li>
  </ul>