4

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

Layout.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>

この問題を解決するための提案はありますか?

4

3 に答える 3

3

仮想パス「~/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 に感謝します。

于 2013-06-13T21:42:23.387 に答える
2

問題に関するこのドキュメントを見つけて、すべてを非常によく説明しています。

お役に立てれば

于 2013-08-27T19:25:08.113 に答える
0

バージョン番号(2016.1.112)を変更して、これを試してください:

BundleConfig.cs

bundles.Add(new StyleBundle("~/Content/kendo/2016.1.112/kendostyles").Include(
                      "~/Content/kendo/2016.1.112/kendo.common-bootstrap.min.css",
                      "~/Content/kendo/2016.1.112/kendo.mobile.all.min.css",
                      "~/Content/kendo/2016.1.112/kendo.dataviz.min.css",
                      "~/Content/kendo/2016.1.112/kendo.bootstrap.min.css",
                      "~/Content/kendo/2016.1.112/kendo.dataviz.bootstrap.min.css"));

BundleTable.EnableOptimizations = true;

_Layout.cshtml

@Styles.Render("~/Content/kendo/2016.1.112/kendostyles")
于 2016-10-20T14:01:31.923 に答える