为什么无法在文件夹中加载所有J和Css?在mvc 5捆绑

时间:2017-10-04 17:10:52

标签: javascript c# css asp.net-mvc

我想知道为什么无法加载All Js和Css文件夹? 我有一个前端视图的文件夹FrontTheme在这个文件夹中有2个文件夹cssjs,我想在包中的FrontTheme文件夹中加载所有js和css文件

我的代码是:

public class BundleConfig
{
    public static void RegisterBundles(BundleCollection bundles)
    {
    //    bundles.Add(new ScriptBundle("~/Content/Admin/js").IncludeDirectory("~/Content/Admin/assets/", "*.js",true));
      //  bundles.Add(new StyleBundle("~/Content/Admin/css").IncludeDirectory("~/Content/Admin/assets/", "*.css",true));

        bundles.Add(new ScriptBundle("~/Content/FrontTheme/js")
            .IncludeDirectory("~/Content/FrontTheme/js", "*.js",true));
        bundles.Add(new StyleBundle("~/Content/FrontTheme/css")
            .IncludeDirectory("~/Content/FrontTheme/css", "*.css",false));


#if DEBUG
        BundleTable.EnableOptimizations = false;
#else
    BundleTable.EnableOptimizations = true;
#endif

并且在视图中我使用:

@Scripts.Render("~/Content/FrontTheme/js")
@Styles.Render("~/Content/FrontTheme/css")

但是捆绑包没有加载css和js文件,浏览器让我获得403禁止状态。

哪里错了? codes statuscode

--- ---更新 即使我将包名更改为

~/Content/FrontThemejs

~/FrontTheme/js

~/FrontThemejs

~/Frontjs

Frontjs

~/123/js

~/Content/FrontThemecss

~/FrontTheme/css

~/FrontThemecss

~/Frontcss

Frontcss

~/456/css

403的状态代码更改为404

Failed to load resource: the server responded with a status of 404 (Not Found)

0 个答案:

没有答案