1

Right now I have some code which needs to be executed only once in the application life cycle. I have that code in application_start event but this slows down my first request has there is some heavy configuration to be done.

Is there any alternative to this? Is it possible to execute some logic during the deployment process?

dasdom
  • 13,975
  • 2
  • 47
  • 58
user1901680
  • 81
  • 1
  • 3

1 Answers1

0

This will happen every time your app pool recycles. So if you app pool recycle once a day the first request following the recycle will be slow. What I have done to mitigate this issue is to have a script hit the web site right after the app recycles to take the initial performance hit instead of an end user.

mosesfetters
  • 1,688
  • 16
  • 25
  • That sounds interesting. Can I know how to write such a script? – user1901680 Dec 30 '12 at 17:33
  • I use https://github.com/kennethscott/ASP.NET-Site-Warmup but you could use a windows scheduled task to do it as a test first see http://stackoverflow.com/questions/1987345/recommended-method-for-loading-a-url-via-a-scheduled-task-on-windows for an example. – mosesfetters Dec 30 '12 at 21:28
  • Were you able to get the app to warm up? – mosesfetters Jan 04 '13 at 15:45