MVC script package optimization leads to a huge load on the server

Using:

  • MVC 5.2.0.0
  • Microsoft.AspNet.Web.Optimization 1.1.3
  • Visual studio 13
  • latest updates at the time of this writing

My host service dropped my application pool because I overcame the limits. Their limit is 300 MB per message or Get. It seemed enough! So what is going on? I used Fiddler to find out that binding is causing me a serious headache.

If I use loading script in layouts:

    <script src="@Url.Content("~/Scripts/jquery-2.1.1.min.js")"></script>

etc., using Fiddler, I see that my page loads with about 55 thousand scripts, for everything I need to run.

If I use:

    @Scripts.Render("~/bundles/jquery")

etc., Fiddler reports a 7 MB download for only one pack, and it quickly descends from the hill ...

- , , , .

, ​​ ""? , , - , .

:

, 300 - . , .

, ( , , ).:

            bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                    "~/Scripts/jquery-{version}.js",
                    "~/Scripts/jquery.validate*",
                    "~/Scripts/modernizr-*",
                    "~/Scripts/site.js",
                    "~/Scripts/bootstrap.js",
                    "~/Scripts/respond.js",
                    "~/Scripts/masonry.pkgd.min.js",
                    "~/Scripts/jquery.zoom.min.js",
                    "~/Scripts/AnimOnScroll.js",
                    "~/Scripts/classie.js",
                    "~/Scripts/imagesloaded.js",
                    "~/Scripts/util.js"));

- - : DiscountASP.net

, 550K 7

+4
1

BundleConfig.cs, :

BundleTable.EnableOptimizations = false;

, .

, , - "*" .

0

All Articles