MVC4 RC脚本捆绑很慢 [英] MVC4 RC script bundling very slow

查看:136
本文介绍了MVC4 RC脚本捆绑很慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我今天升级的大项目,MVC4 RC尝试捆绑和缩小。

I upgraded a large project to MVC4 RC today to try out the bundling and minification.

在我曾在一个局部视图脚本SRC标签8静态js文件。样本页跑下0.1秒一致。

Before I had 8 static js files in script src tags in a partial view. A sample page ran in under .1 seconds consistently.

我说像这样的包:

    bundles.Add(New ScriptBundle("~/bundles/mybundle").Include(
                "~/Resources/Core/Javascripts/jquery-1.7.1.min.js",
                "~/Resources/Core/Javascripts/jquery-ui-1.8.16.min.js",
                "~/Resources/Core/Javascripts/jquery.validate.min.js",
                "~/Resources/Core/Javascripts/jquery.validate.unobtrusive.min.js",
                "~/Resources/Core/Javascripts/jquery.unobtrusive-ajax.min.js",
                "~/Resources/Core/Javascripts/bootstrap.min.js",
                "~/Resources/Core/Javascripts/toolbar.js",
                "~/Resources/Core/Javascripts/jquery-ui-timepicker-addon.js"))

在部分我加了这一点,并在页面加载时间提高到0.5秒始终与编译调试为真和假。
    @ Scripts.Render(〜/包/ mybundle)

In the partial I added this and the page load time increased to .5 seconds consistently with compilation debug as true and as false. @Scripts.Render("~/bundles/mybundle")

然后,我喜欢这个miniprofiler包裹它:

I then wrapped it with miniprofiler like this:

 Dim profiler = MiniProfiler.Current
 Using profiler.Step("bundling")   
       @Scripts.Render("~/bundles/mybundle")
 End Using

捆绑步骤需要0.4秒一致。

The bundling step takes .4 seconds consistently.

该计算机是在现代硬件上运行VS2010具有高端的SSD驱动器和运行任何非标准的后台任务。当我删除@ scripts.render的页面加载时间再次下降.1秒。

The computer is a running VS2010 on modern hardware with a high end SSD drive and no nonstandard background tasks running. As soon as I delete the @scripts.render the page load time drops again to .1 seconds.

有没有一种方法,使打捆缓存还是我缺少的就是使它成为这个东西慢?

Is there a way to make the bundler cache or am I missing something that is making it be this slow?

推荐答案

这是一个已知的bug,在ASP.NET MVC 4 RC捆绑。该捆绑未被缓存的服务器端。

This is a known bug with bundling in ASP.NET MVC 4 RC. The bundling is not being cached server-side.

该错误是在这里详细描述:
<一href=\"http://todd-carter.com/post/2012/06/10/mini-me-fication-in-system-web-optimization-rc-is-evil/\" rel=\"nofollow\">http://todd-carter.com/post/2012/06/10/mini-me-fication-in-system-web-optimization-rc-is-evil/

The bug is described in detail here: http://todd-carter.com/post/2012/06/10/mini-me-fication-in-system-web-optimization-rc-is-evil/

应该有一个更新的NuGet MVC 4 RC包在某个时间6月17日,2012年(截至来源的一周:的 https://twitter.com/howard_dierking/status/212725872904507392

There should be an update to the nuget MVC 4 RC package sometime in the week ending 17 June, 2012. (Source: https://twitter.com/howard_dierking/status/212725872904507392)

这篇关于MVC4 RC脚本捆绑很慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆