4

I've got a strange problem; normally when you set debug=false in your web.config file and compile your web application in Release mode, it increases performance. For some pages on my site, it's majorly slowing down the rendering. Here's the page in debug mode:

Debug mode on

... and here's that same page in Release mode with debug mode turned OFF:

Debug mode off

No, I didn't get those two confused. What on Earth could be causing debug mode to be rendering the page 3 times quicker (if you ignore the controller and SQL performance, it renders the page FIVE times quicker)?! Is there anything obvious I could have misconfigured?

4

1 回答 1

8

简短的回答:问题是Microsoft.AspNet.Web.Optimizationbeta2;它正在做一些非常低效的事情,并且会在您的页面渲染时间上增加一秒钟。如果您正在使用它,请升级。现在。


我接受了 Steven 的建议并使用 MiniProfiler 查看导致视图变慢的原因。这是System.Web.Optimization.Scripts.Render()jQuery UI JS 的渲染:

之前的渲染时间

根据这个问题的建议(另外,这个问题似乎解决了这个问题),我升级了:

PM> Update-Package Microsoft.AspNet.Web.Optimization
Updating 'Microsoft.AspNet.Web.Optimization' from version '1.0.0-beta2' to '1.0.0' in project 'Bacp.Assess.Web'.

这将同时升级Microsoft.AspNet.Web.OptimizationWebGrease。这是我升级后的同一页面:

之后的渲染时间

嗯。:-) 我刚刚将页面的渲染时间缩短了 99.9%。我网站上的其他页面也呈现得更快。我不知道Microsoft.AspNet.Web.Optimizationbeta2 在做什么,但它就像一个围绕 ASP.NET 的球和链!

于 2013-05-01T12:09:04.687 回答