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

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

问题描述

使用VS'12,Asp.net - C# - InternetApplication模板,KendoUI,EF code首先

这是我的MVC BundleConfig.cs

  bundles.Add(新ScriptBundle(〜/包/ jQuery的)。包括(
                    〜/脚本/ jquery- {}版本的.js));        bundles.Add(新StyleBundle(〜/内容/ CSS),包括(〜/内容/的site.css));        //剑道CSS包
        bundles.Add(新StyleBundle(〜/内容/剑道)。包括(
                〜/内容/剑道/ kendo.common。*,
                〜/内容/剑道/ kendo.default。*));        //剑道的JavaScript捆绑//或者如果你想使用kendo.all.min.js剑道UI Web和剑道UI DataViz公司
        bundles.Add(新ScriptBundle(〜/包/剑道)。包括(
                                    〜/脚本/剑道/ kendo.web.min.js
                                    〜/脚本/剑道/ kendo.aspnetmvc.min.js));

你也应该知道,我在年底运行这些2行 BundleConfig.cs

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

我已经越来越 403拒绝访问,文件故宫错误,当我尝试主持该项目。

我曾尝试使用这真棒帖子作为参考,在那里我没有改变一些东西,但错误依然存在的。

我想认为因为.min文件KendoUI带着它,但我不能肯定。

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

  @ Scripts.Render(〜/包/ jQuery的)
    @ Styles.Render(〜/内容/ CSS)
    @ Styles.Render(〜/内容/剑道)
    @ Scripts.Render(〜/包/剑道)


解决方案

尝试更改

  bundles.Add(新StyleBundle(〜/内容/剑道)。包括(
            〜/内容/剑道/ kendo.common。*,
            〜/内容/剑道/ kendo.default。*));

  bundles.Add(新StyleBundle(〜/包/ CSS /剑道)。包括(
            〜/内容/剑道/ kendo.common。*。CSS
            〜/内容/剑道/ kendo.default * CSS。));

然后

  @ Styles.Render(〜/内容/剑道)

  @ Styles.Render(〜/包/ CSS /剑道)

Using VS'12, Asp.net - C# - InternetApplication Template, KendoUI, EF Code First

This is my 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"));

Also you should know that i am running these 2 lines at the end of BundleConfig.cs

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

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.

I would like to think its because of the .min files KendoUI came with, but i can't be certain.

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

解决方案

Try changing

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

to

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

and then

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

to

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

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

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