Kendo UI 捆绑包在 IIS 中不起作用

2023-12-14

我正在使用 Kendo UI 在 ASP.NET MVC 4 中开发一个应用程序,整个应用程序通过运行 Visual Studio 2012 可以完美运行,但是当发布到 Kendo 的 IIS 包时不起作用,导致整个界面处于未配置状态。 下面是BundleConfig和Layout类的调用代码:

BundleConfig.cs

public class BundleConfig
{
    public static void RegisterBundles(BundleCollection bundles)
    {
        bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
                    "~/Scripts/jquery.unobtrusive*",
                    "~/Scripts/jquery.validate*"));

        bundles.Add(new ScriptBundle("~/bundles/kendo").Include(
                    "~/Scripts/kendo/2013.1.514/jquery.min.js",
                    "~/Scripts/kendo/2013.1.514/kendo.all.min.js",
                    "~/Scripts/kendo/2013.1.514/kendo.aspnetmvc.min.js",
                    "~/Scripts/kendo.modernizr.custom.js",
                    "~/Scripts/kendo/2013.1.514/cultures/kendo.culture.pt-BR.min.js",
                    "~/Scripts/kendo/2013.1.514/cultures/kendo.culture.es-ES.min.js"));

        bundles.Add(new ScriptBundle("~/bundles/noty").Include(
                    "~/Scripts/noty/jquery.noty.js",
                    "~/Scripts/noty/layouts/top.js",
                    "~/Scripts/noty/layouts/topLeft.js",
                    "~/Scripts/noty/layouts/topCenter.js",
                    "~/Scripts/noty/layouts/topRight.js",
                    "~/Scripts/noty/themes/default.js"));

        bundles.Add(new ScriptBundle("~/bundles/nicescroll").Include("~/Scripts/jquery.nicescroll.min.js"));

        bundles.Add(new ScriptBundle("~/bundles/fancy").Include(
                    "~/Scripts/fancy/jquery.fancybox.js",
                    "~/Scripts/fancy/jquery.facybox.pack.js"));

        bundles.Add(new StyleBundle("~/Content/site").Include("~/Content/Site.css","~/Content/ResetKendo.css"));

        bundles.Add(new StyleBundle("~/Content/pwb4").Include("~/Content/pwb4.css"));

        bundles.Add(new StyleBundle("~/Content/kendo").Include(
                    "~/Content/kendo/2013.1.514/kendo.common.min.css",
                    "~/Content/kendo/2013.1.514/kendo.blueopal.min.css",
                    "~/Content/kendo/2013.1.514/kendo.dataviz.min.css",
                    "~/Content/kendo/2013.1.514/kendo.dataviz.blueopal.min.css"));

        bundles.Add(new StyleBundle("~/Content/fancy").Include("~/Content/fancy/jquery.fancybox.css"));


        bundles.IgnoreList.Clear();
        AddDefaultIgnorePatterns(bundles.IgnoreList);
    }

    public static void AddDefaultIgnorePatterns(IgnoreList ignoreList)
    {
        if (ignoreList == null)
            throw new ArgumentNullException("ignoreList");
        ignoreList.Ignore("*.intellisense.js");
        ignoreList.Ignore("*-vsdoc.js");
        ignoreList.Ignore("*.debug.js", OptimizationMode.WhenEnabled);
    }
}

布局.cshtml

<html>
<head>
    <title></title>
    <link href="~/assets/favicon.ico" rel="shortcut icon" type="image/x-icon" />
    <meta name="viewport" content="width=device-width" />
    <meta http-equiv="X-UA-Compatible" content="IE=10; IE=9; IE=8; IE=7; IE=EDGE" />

    @Styles.Render("~/Content/site")
    @Styles.Render("~/Content/pwb4")
    @Styles.Render("~/Content/kendo")
    @Scripts.Render("~/bundles/kendo")
    @Scripts.Render("~/bundles/noty")
    @Scripts.Render("~/bundles/nicescroll")
    @Scripts.Render("~/bundles/jqueryval")

</head>
<body>
</body>
</html>

有人有解决这个问题的建议吗?


我设法通过将虚拟路径“~/Content/kendo”更改为“~/Content/kendoui”来解决该问题。在我的项目中,有一个物理路径“~/Content/kendo”,虚拟路径无法与物理路径匹配。

下面是更正后的代码:

        bundles.Add(new StyleBundle("~/Content/kendoui").Include(
                    "~/Content/kendo/2013.1.514/kendo.common.min.css",
                    "~/Content/kendo/2013.1.514/kendo.blueopal.min.css",
                    "~/Content/kendo/2013.1.514/kendo.dataviz.min.css",
                    "~/Content/kendo/2013.1.514/kendo.dataviz.blueopal.min.css"));

感谢G_P和Win的关注。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Kendo UI 捆绑包在 IIS 中不起作用 的相关文章

随机推荐