2

so all of a sudden my asp mvc 4 bundles stop working:(

I get cancelled as my http status for the bundle URL's.

Any ideas what I do next? I'm using the same virtual paths in my _layout as when it was working

    @Styles.Render("~/foundation/stylesheets")
@Scripts.Render("~/foundation/javascripts")




public class BundleConfig
    {
        public static void RegisterBundles(BundleCollection bundles)
        {
           //JQUERY STUFF
            bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
            "~/Scripts/jquery-1.*"));

        bundles.Add(new ScriptBundle("~/bundles/jqueryplugins").Include(
            "~/Scripts/plugins/jquery.placeholder.js"));

        bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
            "~/Scripts/jquery-ui*"));

        bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
            "~/Scripts/jquery.unobtrusive*",
            "~/Scripts/jquery.validate*"));

        bundles.Add(new StyleBundle("~/Content/themes/base/css").Include(
            "~/Content/themes/base/jquery.ui.core.css",
            "~/Content/themes/base/jquery.ui.resizable.css",
            "~/Content/themes/base/jquery.ui.selectable.css",
            "~/Content/themes/base/jquery.ui.accordion.css",
            "~/Content/themes/base/jquery.ui.autocomplete.css",
            "~/Content/themes/base/jquery.ui.button.css",
            "~/Content/themes/base/jquery.ui.dialog.css",
            "~/Content/themes/base/jquery.ui.slider.css",
            "~/Content/themes/base/jquery.ui.tabs.css",
            "~/Content/themes/base/jquery.ui.datepicker.css",
            "~/Content/themes/base/jquery.ui.progressbar.css",
            "~/Content/themes/base/jquery.ui.theme.css"));

        //FOUNDATION STUFF
        bundles.Add(new ScriptBundle("~/foundation/javascripts").Include(
           "~/foundation/javascripts/app.js",
           "~/foundation/javascripts/foundation.min.js",
           "~/foundation/javascripts/modernizr.foundation.js"));

        bundles.Add(new StyleBundle("~/foundation/stylesheets").Include(
            "~/foundation/stylesheets/app.css",
            "~/foundation/stylesheets/foundation*"));

    }
}
Kyle Trauberman
  • 25,414
  • 13
  • 85
  • 121
Nikos
  • 7,295
  • 7
  • 52
  • 88
  • What do you mean by 'stop working'? Links to the scripts aren't generated? A server doesn't return requested scripts? Scripts are downloaded, but doesn't work? – Lukas Kabrt Dec 07 '12 at 23:12
  • I think it's timing out and the browser is cancelling the request. The chrome network debugger says "canceled" when a server just straight up doesn't respond – scaryman Dec 07 '12 at 23:46
  • But yeah, cancelled isn't a http status code lol – scaryman Dec 07 '12 at 23:46
  • for some reason everything works when in debug mode. In release a link I get in chrome is http://localhost:50701/foundation/javascripts?v=olALUXLq0jE4MNUVLM1XkYn4e170UgxPHyU-htRhKhI1 301 code:moved permenatly, size: from cache. I also get another request to the same link but in chrome it says the initiator is http://localhost:50701/foundation/stylesheets?v=Z5GIW5xAx87hbf6T-rlLBqeVwXbJIeyPUCjTiO8RE6U1 Redirect – Nikos Dec 08 '12 at 11:18

4 Answers4

11

This can happen if your bundle path is the same as an actual path. For example, you have your css in /Content/Css and your build your bundle with the same path thus:

bundles.Add(new StyleBundle("~/Content/Css").Include(
            "~/Content/Css/normalize.css",
            "~/Content/Css/main.css"
        ));
Sprintstar
  • 7,938
  • 5
  • 38
  • 51
2

if ALL of the are being cancelled, it sounds like your routing tables are screwed up. Check them out with http://nuget.org/packages/routedebugger

scaryman
  • 1,880
  • 1
  • 19
  • 30
  • Check out your source control and see what changed inbetween now and the last time it worked, as well. – scaryman Dec 07 '12 at 22:33
  • but this works: @Styles.Render("~/bundles/jquery", "~/bundles/jqueryplugins", "~/bundles/jqueryval") – Nikos Dec 07 '12 at 22:45
  • @Nikos You're rendering your js as Styles? or is that a typo? – NickSuperb Dec 07 '12 at 23:10
  • boooo no source control. Learn git, it's worth it. If you want to keep your repos private you can just use local repos and not upload them to github. Or give github your money, they earned it. – scaryman Dec 07 '12 at 23:47
  • is git easier to get up and running locally than perforce? – Nikos Dec 08 '12 at 00:03
  • fixed that typo , same problem, actual the thing fails locally when removing the debug compile attribute :( – Nikos Dec 08 '12 at 00:09
  • Git v Perforce - http://stackoverflow.com/questions/222782/git-vs-perforce-two-vcs-will-enter-one-will-leave – scaryman Dec 08 '12 at 06:23
  • 1
    And yes, git doesn't need a server at all. on windows, install msysgit and then tortoisegit and you're good to go. – scaryman Dec 08 '12 at 06:24
  • I can't help you with the mvc stuff without more specific error messages man. It could be dying when it tries to minimize your js files, or it could also be dying because it's looking for already (.min.js) files and can't find them? – scaryman Dec 08 '12 at 06:25
2

Don't try to minify a '.min' file. Remove the .min file from the bundle and use the development file.

MuriloKunze
  • 15,195
  • 17
  • 54
  • 82
2

I had the same issue and after days of trying to figure it out I noticed my jquery version is now 2.x and my bundles are referencing jquery-1.*. I did have problems when updating my site using NuGet last time. I think the crash caused my bundles to get updated, but it did not update my references in code. Hopefully this will save someone days from trying to figure out why it happened to them.

This is what my app generated for me when I created it:

bundles.Add(new ScriptBundle("~/bundles/jquery").Include("~/Scripts/jquery-1.*"));
Jason Willett
  • 375
  • 2
  • 13