Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Optimized bundles returning 404 when requesting from the website

I'm having this weird problem when I set:

BundleTable.EnableOptimizations = true;

When I try to open my website it just won't load, when I open Chrome's console I see the following message:

GET /localhost/bundles/scripts/angularjs/commonmodules?v=13-uWpwzN3U6kiHVssXRdpywHxrn09twvYKwoDVN3SU1 404 (Not Found)

However, if I try to open the link shown on chrome's console, it loads just fine, in other words, the link is found when I try to open it directly, but the server (IIS 7.5) returns a 404 when a page tries to link it through a tag.

Have anyone been through such a weird behavior?

The virtual paths for my bundles do not map for any existing file or directory, I include them using the following code:

var myBundle= new ScriptBundle("~/bundles/scripts/angularjs/bootstrapping");
bootstrapping.Include("~/app/app.js")
    .Include("~/app/config.js")
    .Include("~/app/config.exceptionHandler.js")
    .Include("~/app/config.route.js");
bundles.Add(bootstrapping);

And I already tried to add the following lines on web.config's system.webServer:

<modules runAllManagedModulesForAllRequests="true">
    <remove name="BundleModule" />
    <add name="BundleModule" type="System.Web.Optimization.BundleModule" />
</modules>

I'm not sure if this may be related, but I'm using Umbraco v7 on this website, and this only happens if I set EnableOptimizations to "true".

like image 667
leandro koiti Avatar asked Apr 14 '14 03:04

leandro koiti


1 Answers

If I remember correctly it's umbraco config related.

Locate the key umbracoReservedPaths (in appSettings) in your web.config and add the path to bundles there, like so:

<add key="umbracoReservedPaths" value="~/umbraco,~/install/,~/bundles/"/>
like image 196
Major Byte Avatar answered Oct 13 '22 13:10

Major Byte