ASP.NET / MVC 4在64位捆绑和缩小404问题

我们最近将项目从MVC 3升级到了MVC 4.我们的目标是.NET 4.0框架,而我们的Web应用程序是32位的,因为我们必须包含一些参考。

我们遇到的问题是我们将捆绑/缩小从Chirpy转换为内置ASP.NET捆绑。 该网站在运行ONLY .NET 4.0的32位服务器,Windows Server 2003 / IIS 6和2008 / IIS 7.5以及我们的64位开发计算机上都没有问题。 上述所有捆绑/缩小工作都很好。

在安装了.NET 4.0的64位Windows 2008 / IIS 7.5服务器上,捆绑不起作用。 我们为生成的脚本和样式获取了404错误。

如果我们在64位服务器上安装.NET 4.5,它可以正常工作。 我们对此感到困惑,因为有些服务器在没有.NET 4.5的情况下工作,而这需要它。 最重要的是,Windows Server 2003/64位与.NET 4.5不兼容,所以如果出现问题,此修补程序将不起作用。

奇怪的是,针对.NET 4.0 build x86的示例MVC 4示例互联网应用在问题服务器上仅使用4.0就能正常工作。 web.config除了统一,日志记录,elmah和无点配置以外完全相同。

任何帮助,将不胜感激。

这里是BundleConfig.cs:

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"));
        }
    }
}

以下是我们在布局中引用捆绑包的方式:

    @Scripts.Render("~/bundles/WebApp.Main")
    <link href="@Url.Content("~/Content/SiteLess.less")" rel="stylesheet" type="text/css"  />
    @Styles.Render("~/bundles/Content/WebApp.Main")
    ...

编辑:回应/更新

  • 是的,已启用的32位应用程序标志在应用程序池中设置为True。
  • 提供404的请求的路径如下所示http://xx.xx.xx.xxx/WebApp/bundles/WebApp.Main?v=03pBc7hdH1lHLtZGx-JMosNaLpMK7fcmI0uI6auknHw1
  • Windows事件查看器不显示
  • 它在安装.NET 4.5后卸载它,然后重新安装.NET 4.0
  • 它适用于企业2008 64位服务器。 问题服务器是标准版。 我们将重建虚拟机以查看是否解决了这个问题。

  • 您最初遇到404问题的环境可能没有应用无延伸URL修补程序。

    请参阅http://support.microsoft.com/kb/980368

    巧合的是,你的“干净的.NET 4.0”安装版本是4.0以上的版本(可能是4.5版本),或者你可能在不知不觉中应用了修补程序/更新来支持无扩展名的URL。

    我在Windows Server 2008中运行相同的问题(Enterprise; 32位和64位),其中Bundler在运行时没有失败(它正确地创建捆绑包并正确呈现捆绑URL,如/app/bundles/my_script ),但是IIS为该包URL返回了404。 我安装了修补程序980368和捆绑软件开始工作。


    这个问题似乎与我们用于该服务器的虚拟机上的.NET 4.0安装有关。 用干净的.NET 4.0安装创建两个新的虚拟机(包括Windows 2008 64位,一个标准的企业)后,捆绑在两者上都运行良好。 感谢所有的帮助。

    链接地址: http://www.djcxy.com/p/11855.html

    上一篇: ASP.NET / MVC 4 bundling and minification 404 issues on 64

    下一篇: Acoustic Echo Cancellation with Adobe Air on mobile