Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 剑道UI包在IIS中不工作_Html_Asp.net Mvc 4_Kendo Ui - Fatal编程技术网

Html 剑道UI包在IIS中不工作

Html 剑道UI包在IIS中不工作,html,asp.net-mvc-4,kendo-ui,Html,Asp.net Mvc 4,Kendo Ui,我正在使用Kendo UI在ASP.NET MVC 4中开发一个应用程序,通过运行Visual Studio 2012,整个应用程序都可以完美运行,但是当发布到Kendo的IIS包时,该应用程序不起作用,导致整个界面未配置。 下面是类代码BundleConfig和调用的布局: BundleConfig.cs public class BundleConfig { public static void RegisterBundles(BundleCollection bundles)

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

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

<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>
@Styles.Render("~/Content/kendo/2016.1.112/kendostyles")

@style.Render(“~/Content/site”)
@style.Render(“~/Content/pwb4”)
@style.Render(“~/Content/kendo”)
@Scripts.Render(“~/bundles/kendo”)
@Scripts.Render(“~/bundles/noty”)
@Scripts.Render(“~/bundles/nicesroll”)
@Scripts.Render(“~/bundles/jqueryval”)

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

我通过将虚拟路径“~/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的关注。

发现这件事很好地解释了一切

希望这有助于更改版本号(2016.1.112),并尝试以下操作:

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);
    }
}
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;
\u 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>
@Styles.Render("~/Content/kendo/2016.1.112/kendostyles")

我相信您已经完成了这里的剑道步骤,但以防万一:如果您使用浏览器开发工具,所有捆绑包都会显示为已加载。例如,使用Chrome,在Sources->Site Name->bundles下会显示什么?另外,如果您将jquery拉出到它自己的bundle中会发生什么情况(正如我在前面的评论中链接到的官方剑道步骤中所做的那样),您是否可以确保您没有运行调试模式?这就是为什么ms guys advice使用~/bundle/。。。为了防止可能的路由冲突,请执行以下操作: