开发者

ASP.NET MVC App takes ages to respond sometimes

I h开发者_运维技巧ave an ASP.NET MVC app running in IIS7. Sometimes when I type the URL into a browser it takes 5-10 seconds before it responds, then after that it is fine. It's like it's taking it's time starting/waking up.

How should I best proceed with trying to identify the problem?


This is probably normal behaviour rather than a problem. It's probably going to sleep because it hasn't had any requests for a long time. You can try changing the Idle Timeout under the Application Pool's advanced settings or if you're running .NET 4.0, you can keep the application always running.


If this is happening right after you've edited ASPX files or rebuilt other .NET sources (e.g., *.cs), then it's probably because of the JIT native code generation of the .NET code. This can be solved by a warm-up utility like the (currently defunct, sadly) IIS warm-up module.


You can use ASP.NET Mini Profiler to check what takes too long to load. Web.config re-saving can cause your application to be restarted and if your website is not compiled, it takes longer to load as well, plus if you have a heavy database call. In other words, there's no general solution for this, it depends on how you design the application and then improve what appear to be not efficient.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜