application compiles every 15 minutes

十年热恋 提交于 2019-12-18 21:52:33

问题


I am using ASP.Net4 MVC2 for my application. The first person using the application usually experiences a long wait before the application responds. After that the application is pretty responsive. If the application is idle for 15 minutes, the same person or the next person using the application will experience long wait again. It looks like the application compiles after being idle for 15 minutes. Can someone tell me where I should look to trouble shoot the problem? Thanks.


回答1:


It is almost certainly the case that what you are experiencing is app pool recycling. It's true it takes some time to re-initialize after the pool has been recycled, but it shouldn't take all that long. How long is a "long wait"? A second? Several? In IIS you can configure how regularly your app pool recycles. For IIS 7, right-click on your app pool and choose "Advanced Settings" then look at "Idle Time-out". You may consider increasing this value. (Or set to 0 to disable completely.)




回答2:


You need to accurately diagnose the problem first before you start implementation solutions. First have to verify if it is, in fact, an app pool recycle. You can start by adding this section to your web.config:

<healthMonitoring>
      <rules>
        <add name="Application Lifetime Events Default"
             eventName="Application Lifetime Events"
             provider="EventLogProvider"
             profile="Default"
             minInstances="1"
             maxLimit="Infinite"
             minInterval="00:01:00"
             custom="" />
      </rules>
</healthMonitoring>

It will log an event to the windows event log anytime asp.net recycles itself. It will also gives a reason for the recycle (e.g., someone poked web.config, etc.). If it is a recycle, then you need to figure out why it is recycling. Is it because IIS is set to do it no matter what? Is it because your app is not handling memory correctly and memory pressure is causing asp.net to want to recycle itself? These questions must be answered first.

First determine if it is a recycle by adding to above configuration and why. Once you get the answer you can check memory, etc.




回答3:


Have a look at the IIS7 application warmup extension.

http://www.iis.net/download/ApplicationWarmUp



来源:https://stackoverflow.com/questions/3938526/application-compiles-every-15-minutes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!