MVC 捆绑:错误 403 [英] MVC bundeling : Err 403

查看:19
本文介绍了MVC 捆绑:错误 403的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 VS'12、Asp.net - C# - Internet 应用程序模板、KendoUI、EF 代码优先

这是我的 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 Access Denied、File Forbidden Errors.

I have been getting 403 Access Denied , File Forbidden Errors when I try to host the project.

我尝试使用 这篇很棒的帖子 作为参考,我确实改变了一些东西,但错误仍然发生.

I have tried to use This Awesome Post as a reference, where I did change some things, but errors are still occuring.

我想这是因为 KendoUI 附带的 .min 文件,但我不能确定.

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

For your reference this is my _Layout.cshtml, and how i call the scripts.

    @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")

这篇关于MVC 捆绑:错误 403的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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