I need some pointers on how to diagnose this problem. I've got bundling and minification working just great on my local project, but when I copy the changes up to my web host, I just get a bunch of 404 errors trying to load those bundles. Both sites are running identical code - one bundles fine, the other doesn't.
I have a BundleConfigs.cs in my App_Code directory that has for example:
bundles.Add(new ScriptBundle("~/bundles/default").Include("~/default.js"));
Along with a few bundles.Add loading jquery etc. from the microsoft CDN.
I have a bundle.config for all my css files, with a styleBundle like:
<styleBundle path="~/Content/css"><include path="~/Content/normalize.css" /><include path="~/Content/main.css" /><include path="~/Content/Site.css" /></styleBundle>
In my global.aspx:
void Application_Start(object sender, EventArgs e) { BundleConfig.RegisterBundles(BundleTable.Bundles); }
In my site.master file in the <head>:
<webopt:BundleReference runat="server" Path="~/Content/css" />
In my default.aspx, I have a few Scripts.Render calls to load jquery etc. For example:
<%: Scripts.Render("~/bundles/default") %>
among others for jquery etc.
So everything seems correct (hopefully, this is my first time getting this to work) and in fact it DOES work like a charm on my local machine. I can turn debug off and notice on the Net panel in Firebug that it is most definitely not loading all the individual css/js files but only a few bundles. Awesome!
However the site, with the same exact files, on my web host, fails. All the bundle loads result in 404 errors.
My guess is that this is maybe a directory permission problem on the host? I tried giving the anonymous user rights to write to various directories, but that didn't make a difference. Where are these actual bundles being stored on the web server to be served up? I can't even begin to diagnose what is going wrong. I've looked very carefully at my local vs. host web.config looking for differences, and I can't spot anything obvious that has anything to do with bundling...
Anyone have any tips on how I can get this working or figure out why it is failing?
For now I've set BundleTable.EnableOptimizations = false in BundleConfig.cs to turn it all off, which works fine.