Dheeraj Kumar
Dheeraj Kumar

Reputation: 4175

Failed to load resource; the server responded with a status of 404 - bundles/jquery - MVC

I am using bundling in MVC ASP.net

Here is my BundleConfig class. public class BundleConfig {

    public static void RegisterBundles(BundleCollection bundles)
    {
        bundles.IgnoreList.Clear();

        bundles.Add(new ScriptBundle("~/bundle/jquery").Include(
                    "~/Scripts/jquery-1.9.1.js"));

        bundles.Add(new ScriptBundle("~/bundle/js").Include(
                    "~/Scripts/bootstrap.js"));

        bundles.Add(new StyleBundle("~/bundle/css").Include(
                    "~/Content/bootstrap.min.css",
                    "~/Content/bootstrap.css"));

    }
}

_Layout.cshtml Here I am rendering bundles

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width" />
    <title>@ViewBag.Title</title>
    @Styles.Render("~/bundle/css")
</head>
<body>
    @RenderBody()
    @Scripts.Render("~/bundle/jquery")
    @Scripts.Render("~/bundle/js")
</body>
</html>

On running my application I get error in browser console

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

Any help is appreciated.

Upvotes: 0

Views: 8860

Answers (1)

Tom John
Tom John

Reputation: 784

Are you registering bundles (Global.asax):

protected virtual void Application_Start() {
   BundleConfig.RegisterBundles(BundleTable.Bundles);
}

Upvotes: 3

Related Questions