MVC4 style bundle giving 403

My bundles were registered as paths which corresponded to an actual folder on the solution, e.g. ~/Content/forum.

This works fine when bundling is turned off (the bundle is included correctly!), but not when bundling is enabled.

The solution is to change the registered name of the bundle to not be the same as anything that exists in the file system.


In my case bundle was specified as a directory @Scripts.Render("~/scripts") so IIS did not know how to serve the actual js file, I changed the bundle name to represent a javascript file @Scripts.Render("~/scripts.js") and that fixed it. The same was true for my style bundle.