加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net-mvc – MVC捆绑:错误403

发布时间:2020-12-15 23:44:11 所属栏目:asp.Net 来源:网络整理
导读:使用VS’12,Asp.net – C# – InternetApplication Template,KendoUI,EF Code First 这是我的MVC BundleConfig.cs bundles.Add(new ScriptBundle("~/bundles/jquery").Include( "~/Scripts/jquery-{version}.js")); bundles.Add(new StyleBundle("~/Content/
使用VS’12,Asp.net – C# – InternetApplication Template,KendoUI,EF Code First

这是我的MVC BundleConfig.cs

bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                    "~/Scripts/jquery-{version}.js"));

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

        // The Kendo CSS bundle
        bundles.Add(new StyleBundle("~/Content/kendo").Include(
                "~/Content/kendo/kendo.common.*","~/Content/kendo/kendo.default.*"));

        // The Kendo JavaScript bundle// or kendo.all.min.js if you want to use Kendo UI Web and Kendo UI DataViz
        bundles.Add(new ScriptBundle("~/bundles/kendo").Include(
                                    "~/Scripts/kendo/kendo.web.min.js","~/Scripts/kendo/kendo.aspnetmvc.min.js"));

另外你应该知道我在BundleConfig.cs的末尾运行这两行

bundles.IgnoreList.Clear();
        bundles.DirectoryFilter.Clear();

当我尝试主办项目时,我已经得到403访问被拒绝,文件禁止错误.

我试图使用This Awesome Post作为参考,在那里我改变了一些事情,但错误仍然发生.

我想认为它是因为KendoUI的.min文件来的,但我不能肯定.

为了您的参考,这是我的_Layout.cshtml,以及我如何调用脚本.

@Scripts.Render("~/bundles/jquery")
    @Styles.Render("~/Content/css")
    @Styles.Render("~/Content/kendo")
    @Scripts.Render("~/bundles/kendo")

解决方法

尝试改变
bundles.Add(new StyleBundle("~/Content/kendo").Include(
            "~/Content/kendo/kendo.common.*","~/Content/kendo/kendo.default.*"));

bundles.Add(new StyleBundle("~/bundles/css/kendo").Include(
            "~/Content/kendo/kendo.common.*.css","~/Content/kendo/kendo.default.*.css"));

接着

@Styles.Render("~/Content/kendo")

@Styles.Render("~/bundles/css/kendo")

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读