asp.net-mvc – Sitecore 6.6,MVC 3和System.Web.Optimization?
发布时间:2020-12-16 03:42:02 所属栏目:asp.Net 来源:网络整理
导读:Sitecore还不支持MVC 4,我想使用System.Web.Optimization的捆绑和缩小. 对捆绑包的请求以404 Not Found响应. BundleConfig.cs: public class BundleConfig{ // For more information on Bundling,visit http://go.microsoft.com/fwlink/?LinkId=254725 publ
Sitecore还不支持MVC 4,我想使用System.Web.Optimization的捆绑和缩小.
对捆绑包的请求以404 Not Found响应. BundleConfig.cs: public class BundleConfig { // For more information on Bundling,visit http://go.microsoft.com/fwlink/?LinkId=254725 public static void RegisterBundles(BundleCollection bundles) { bundles.Add(new ScriptBundle("~/bundles/jquery").Include( "~/Scripts/jquery-{version}.js")); bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include( "~/Scripts/jquery-ui-{version}.js")); bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include( "~/Scripts/jquery.unobtrusive*","~/Scripts/jquery.validate*")); // Use the development version of Modernizr to develop with and learn from. Then,when you're // ready for production,use the build tool at http://modernizr.com to pick only the tests you need. bundles.Add(new ScriptBundle("~/bundles/modernizr").Include( "~/Scripts/modernizr-*")); bundles.Add(new StyleBundle("~/content/css").Include( "~/Content/site.css","~/Content/960.gs/960.css")); bundles.Add(new StyleBundle("~/Content/themes/base/css").Include( "~/Content/themes/base/jquery.ui.core.css","~/Content/themes/base/jquery.ui.resizable.css","~/Content/themes/base/jquery.ui.selectable.css","~/Content/themes/base/jquery.ui.accordion.css","~/Content/themes/base/jquery.ui.autocomplete.css","~/Content/themes/base/jquery.ui.button.css","~/Content/themes/base/jquery.ui.dialog.css","~/Content/themes/base/jquery.ui.slider.css","~/Content/themes/base/jquery.ui.tabs.css","~/Content/themes/base/jquery.ui.datepicker.css","~/Content/themes/base/jquery.ui.progressbar.css","~/Content/themes/base/jquery.ui.theme.css")); } } _Layout.cshtml: @using System.Web.Optimization <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title>@ViewBag.Title</title> @Styles.Render("~/Content/css") @Scripts.Render("~/bundles/modernizr") </head> <body> <div class="container_12"> <a href="/"><h1>Title</h1></a> @Html.Action("Utilities","Navigation") @Html.Action("Menu","Navigation") @RenderBody() </div> @Scripts.Render("~/bundles/jquery") @RenderSection("scripts",required: false) </body> </html> 捆绑包的路径是虚拟的,不会映射到物理文件夹. 忽略路由会引发NotImplementedException和500 Internal Server Error: routes.IgnoreRoute("content/{*pathInfo}"); routes.IgnoreRoute("bundles/{*pathInfo}"); ..但否则,请求由Sitecore处理并以404 Not Found Redirect响应. 我也尝试过: <system.webServer> <modules runAllManagedModulesForAllRequests="false"> <remove name="BundleModule"/> <add type="System.Web.Optimization.BundleModule" name="BundleModule"/> </modules> 我无法让这一切共同发挥作用.救命! 解决方法
圣母玛利亚!
破解以下路线: routes.MapRoute( "sc_ignore_Bundles_Css","content/{*pathInfo}" ); routes.MapRoute( "sc_ignore_Bundles_Js","bundles/{*pathInfo}" ); (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net – 在Azure Compute Emulator之外运行DiagnosticMo
- asp.net – 如何摆脱包含GridView的空div
- 如何获取asp.net c#的文章数据
- ASP.Net MVC文件上传后期参数
- ASP.NET / IIS:404适用于所有文件类型
- asp.net-mvc – 从桌面开发人员的角度来学习ASP.NET MVC的建
- asp.net-mvc-3 – 如何拦截MVC应用程序中的所有控制器调用?
- asp.net-mvc-3 – 可以用“@:@”修复的MVC4剃刀的可能的突
- 如何在ASP.NET页面上注册自定义服务器控件
- ASP.NET C#在SQL Server数据库表中搜索
推荐文章
站长推荐
- ASP.NET站点.将整个域从http重定向到https
- asp.net-mvc – 清除Kendo Validator错误消息
- 关于在asp.net mvc中实现忘记密码功能的一些问题
- asp.net-mvc-3 – IIS中缺少UrlRoutingModule
- 带有子项的ASP.NET自定义/用户控件
- asp.net-mvc – MVC发布IPagedList
- asp.net-mvc – 是否可以为模型中的字段指定标签
- ASP.NET – 将JSON从jQuery传递到ASHX
- ASP.NET 4菜单隐藏在包含Silverlight应用程序的d
- asp.net – 带有MVC 2的自定义ViewModel强类型HT
热点阅读