ASP.NET / MVC 4在64位IIS 7.5服务器上捆绑和缩小404问题
我们最近将我们的项目从MVC 3升级到MVC 4.我们的目标是.NET 4.0框架,我们的Web应用程序是32位,因为我们必须包含一些参考.
我们遇到的问题是我们将捆绑/缩小从Chirpy转换为内置的ASP.NET捆绑.该站点在32位服务器上运行,包括仅运行.NET 4.0的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内置x86的示例MVC 4示例互联网应用程序在问题服务器上只有4.0就可以正常工作.除了unity,logging,elmah和dot less配置之外,web.config完全相同. 任何帮助都将非常感激. 这是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问题的环境可能没有应用无扩展名的URL修补程序.
见http://support.microsoft.com/kb/980368 巧合的是,您的“干净的.NET 4.0”安装版本是4.0之后的版本(可能是4.5?),或者您可能在不知不觉中应用了修补程序/更新以启用对无扩展名URL的支持. 我在Windows Server 2008盒子(Enterprise; 32bit和64bit)中遇到了同样的问题,其中捆绑器在运行时没有失败(它正确地创建了捆绑包,并且正确地渲染了捆绑URL,比如/ app / bundles / my_script),但是IIS为包URL返回了404.我安装了修补程序980368,捆绑包开始工作. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- asp.net-mvc – 关于使用重写的AuthorizeAttribute,线程安全
- ASP.NET MVC下的异步Action的定义和执行原理
- asp.net-web-api – APIController“已执行”方法?
- asp.net-mvc – 创建一个值为0到10的asp.net mvc下拉列表的
- asp.net – 安装.net 4.5自定义表单身份验证后中断
- .net – 什么是dnu换行?
- .Net Core微服务入门全纪录(七)——IdentityServer4-授权
- 实现对Asp.NetMvc及Asp.NetCore的权限控制
- asp.net-mvc – 使旧会话Cookie无效 – ASP.Net标识
- .net – 传递的主键值的数量必须与实体上定义的主键值的数量