捆绑的Kendo UI无法在IIS中运行 [英] Bundle of Kendo UI is not working in IIS

查看:157
本文介绍了捆绑的Kendo UI无法在IIS中运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am developing an application in ASP.NET MVC 4 using Kendo UI, and the entire application works perfectly by running Visual Studio 2012, but when publishing to the IIS bundle of Kendo is not working, leaving the entire interface unconfigured. Below is the class code BundleConfig and Layout with the call:

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>

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

Does anyone have a suggestion to solve this problem?

推荐答案

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

I managed to solve the problem by changing the virtual path "~/Content/kendo" to "~/Content/kendoui". In my project there is a physical path "~/Content/kendo" and the virtual path can not match the physical path.

以下是更正后的代码:

        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。

I thank the attention G_P and Win.

这篇关于捆绑的Kendo UI无法在IIS中运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆