我有一个使用MVC4的旧系统。现在,我需要添加Kendo UI的新样式和脚本文件,但出现一些错误。
public static void RegisterBundles(BundleCollection bundles)
{
#region ---- Style ----
bundles.Add(new StyleBundle("~/bundles/styles").Include(
"~/Content/Styles/normalize.css",
"~/Content/Styles/iconRD.css",
"~/Content/Styles/xcaptcha.css",
"~/Content/Styles/font-awesome.css"
));
bundles.Add(new StyleBundle("~/Content/Kendo/styles").Include(
"~/Content/Kendo/kendo.common.min.css",
"~/Content/Kendo/kendo.default.min.css",
"~/Content/Kendo/kendo.blueopal.min.css"
));
#endregion ---- Style ----
#region ---- Script ----
bundles.Add(new ScriptBundle("~/bundles/script").Include(
"~/Scripts/jquery-{version}.js",
"~/Scripts/jquery.tmpl.js",
"~/Scripts/xcaptcha-2.0.js",
"~/Scripts/jquery.cookie.js",
"~/Scripts/jssip-0.7.10.js",
"~/Scripts/sortable.js",
"~/Scripts/jquery.inputmask.js",
"~/Scripts/jquery.inputmask.date.extensions.js",
"~/Scripts/numeral.min.js",
"~/Scripts/lodash.js",
"~/Scripts/require.js",
"~/Scripts/culture.js"
));
bundles.Add(new ScriptBundle("~/Scripts/kendo").Include(
"~/Scripts/Kendo/kendo.all.min.js",
"~/Scripts/Kendo/kendo.aspnetmvc.min.js",
"~/Scripts/Kendo/kendo.modernizr.custom.js",
"~/Scripts/common.js",
"~/Scripts/controls.js",
"~/Scripts/business.js",
"~/Scripts/attachfileV2.js"
));
#endregion ---- Script ----
}
我的_Layout.cshtml文件:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<head>
...
@Styles.Render("~/bundles/styles")
@Styles.Render("~/Content/Kendo/styles")
@RenderPage("../Shared/_Environment.cshtml")
@Html.RenderJsCulture()
@Scripts.Render("~/bundles/script")
@Scripts.Render("~/Scripts/kendo")
...
</head>
当我运行网站时,第一个样式包(~/bundles/styles
)获得成功,但是第二个样式包出现错误,并且没有加载任何样式文件。
获取http://localhost:8888/Content/Kendo/styles net :: ERR_ABORTED 404(找不到路径'/ Content / Kendo / styles'的控制器或未实现IController。)
这看起来像捆绑包请求http://localhost:8888/Content/Kendo/styles
作为MVC结构的URL来获取视图并获取错误,因为它找不到控制器。
为什么会出现此错误以及如何解决此问题?
谢谢大家。