Using CDN in MVC script bundle. What am I missing?

asp.net-mvc, c#, cdn

Solution

Run your application in `debug="false"` mode or use `BundleTable.EnableOptimizations = true;`

Problem

I am trying to use a CDN for loading jquery. I have read this article and this seems like it should be very straightforward. My script bundle is defined as follows. ``` bundles.UseCdn = true; bundles.Add(new ScriptBundle("~/bundles/jquery", "http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.1.min.js").Include( "~/Scripts/jquery-{version}.js")); ``` I am including it on the page as follows: ``` <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width" /> <title>@ViewBag.Title</title> @Styles.Render("~/Content/css") @Scripts.Render("~/bundles/modernizr") </head> <body> @RenderBody() @Scripts.Render("~/bundles/jquery") @RenderSection("scripts", required: false) </body> </html> ``` But when I look at firebug it seems that jquery is being loaded from localhost. I have tried with both realease and debug builds. What am I missing? I think this should be quite straightforward. Thanks.

Original source