开发者

How do I decrease first load time in ASP.net MVC 2?

开发者 https://www.devze.com 2023-02-03 06:42 出处:网络
I have an ASP.net MVC 2 application that runs well locally. However when I move the files to my production server, I get a first time lag of about 30 seconds, I assume this is a first compile. After t

I have an ASP.net MVC 2 application that runs well locally. However when I move the files to my production server, I get a first time lag of about 30 seconds, I assume this is a first compile. After that the application works fine. Then after about 20-30 minutes of non use, the applications takes another 30 seconds or so to load.

I did try to precompile the code, but there is still a lag during the first load.

Are there any trick to getting the application to work fast开发者_高级运维er on the first load?

I am using ASP.net 3.5, IIS 6 , visual studio 2010, MVC 2.

Thanks


Scott Gu has a good blog post here

EDIT:

There is a similar post here on serverfault, which might be useful.


I decided to write a Windows Service application to call my pages every 10 minutes, so far it's working well.


Essentially, the application pool is idle and is automatically shutting down the worker process. Then, when you try to access the page, it needs to start up the worker process and get everything ready.

If you're running under Server 2003, you can tell it not to shut down the worker process. Benson Yu has a good response here:

http://forums.asp.net/p/1307768/2666610.aspx

Essentially, go to IIS manager, find your asp.net 3.5 application pool that hosts your application, and modify it's performance properties to either not shut down the worker process, or to have a longer timeout.

0

精彩评论

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