This project is read-only.

Enabling Web Optimization on IIS6

Dec 17, 2012 at 2:27 PM

I'm having problems getting ASP.NET Web Optimization framework to work on IIS6. It always uses the expanded bundles from the debug configuration. I have tried my deployment configuration on a second server running IIS7 and using everything works as expected.

However the production Server runs on IIS6 and I wonder if this Version is supported by Web Optimization. I have tried both stable and alpha versions.

Feb 13, 2013 at 2:46 AM
Hi,

I tried ASP.NET Web Optimization framework on IIS6 and it works for my case so I wanted to know more about your scenario to which will help us investigate this issue better

Following is my BundleConfig
 var bundles = BundleTable.Bundles;
            bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                "~/Scripts/jquery-{version}.js")); 
I could see that by switching the debug flag=true/false in web.config I was able to render out the minified/non minified version of jquery

Can you please post your sample application in particular your Bundle configuration?
Feb 13, 2013 at 11:12 AM
Hi,

unfortunately I can't provide the full source code, because of legal issues.
I can send you the bundle configuration.

But before that I have to tell you something about the production system, maybe this could be the root of the issue:
The application runs as an ASP.NET 4.0 web application folder under an ASP.NET 2.0 root site (which is a necessity, because otherwise it would break the running website, which is maintained by a 3rd party)
I have noticed that this setup breaks the extensionless routing, so that it is necessary to register the routes the "old" way. Could this be also the reason why the bundling doesn't work?

The bundle configuration is really straightforward and looks as following
        public static void RegisterBundles(BundleCollection bundles)
        {
            bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
                "~/Scripts/modernizr-{version}.js"));

            bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                "~/Scripts/underscore.js",
                "~/Scripts/numeral.js",
                "~/Scripts/languages/de-de.js",
                "~/Scripts/jquery-{version}.js",
                "~/Scripts/jquery.dateFormat-{version}.js"));

            bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
                "~/Scripts/jquery-ui-{version}.js",
                "~/Scripts/slimScroll.js"));

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

            bundles.Add(new ScriptBundle("~/bundles/knockout").Include(
                "~/Scripts/json2.js",
                "~/Scripts/knockout-2.2.1.debug.js",
                "~/Scripts/knockout.dirtyFlag.js"));

            bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
                "~/Scripts/modernizr-*"));

            bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
                "~/Scripts/bootstrap.js"));

            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"));

            // App specific

            bundles.Add(new StyleBundle("~/Content/css").Include(
                "~/Content/Fonts.css",
                "~/Content/bootstrap.css",
                "~/Content/Site.css",
                "~/Content/HGV.css"));
        }
Feb 15, 2013 at 8:07 PM
This could be the problem....Bundling relies on routing and with your configuration since extensionless routes do not work, bundling will not work as well..
Feb 18, 2013 at 9:47 AM
Okay, I fixed it now by appending a .cssx extension to the css bundles and a .jsx extension to the javascript bundles and it works now!

Steps:
  • Update the bundle configuration and the Script.Render and Style.Render calls in the view files
  • Add the mime-types for cssx and jsx (don't know if this is absolutely needed)
  • Add the ASP.NET handler mappings to the new file extensions
  • Deploy your application
Works like a charm!