Slow first page load on asp.net site

后端 未结 6 733
春和景丽
春和景丽 2020-11-29 22:14

Every now and then (always after a long period of idle-time, e.g. overnight) when I access a site built using asp.net - it takes around 15 seconds to load the page (15 secon

相关标签:
6条回答
  • 2020-11-29 22:49

    You can schedule the recycling of the application pool, possibly using a warm-up script. Give it its own application pool first and see if that helps.

    0 讨论(0)
  • 2020-11-29 22:52

    You could also look into the Auto-Start feature of the 4.0 framework.

    0 讨论(0)
  • 2020-11-29 23:02

    Futhering the answers that noted IIS will shut down an idle, as your site comes back up your Application.OnStart will fire (within your global.asa) If you are doing a lot of work here this may slow your application. Other things going on all your caches will be empty, all your DB connection will be disconnected.

    This behaviour is configurable in IIS, if you do not have access to the IIS settings a hacky way around this is to hit your site every 10 minites either from a script or a special page that has a meta refresh.

    Your other option is to accept that the first page hit of the day will take a few seconds longer then usal.

    0 讨论(0)
  • 2020-11-29 23:03

    I've encountered the same problem in the past. I never managed to get to bottom of the problem, but I suspected that the IIS application pools were the culprit.

    0 讨论(0)
  • 2020-11-29 23:09

    The IIS application pool is shut down after 30 minutes of inactivity. After that, when you make a request IIS basically has to start the website up again, which leads to the behavior you are describing. You can change the idle time of your website in iis though to avoid it.

    0 讨论(0)
  • 2020-11-29 23:10

    If you're using IIS 7 there is an IIS plugin call Application Warm Up that will help

    I've written a blog post about my experiences using it here (don't know if i'm allowed to post to my own content?):

    http://www.diaryofaninja.com/blog/2010/05/06/keep-your-aspnet-websites-warm-and-fast-247

    0 讨论(0)
提交回复
热议问题