0

we are hosting a WCF service inside IIS 6. A ServiceHostFactory creates the ServiceHost when the first request to a service appears. In the OnOpening() Method of the ServiceHost, we load some data into a cache implemented as a static property.

Since loading the data takes about 1 minute we do not want the "first user of the day" to wait for the cache to be filled. The problem is that the ServiceHost and thus the cache are killed with each recycling of the ApplicationPool. Is there any possibility to detect a recycling and refill the cache? Or are there other best practices? I can't believe we are the only ones with this problem...

Thanks in advance!

ceder
  • 3
  • 1
  • 2

2 Answers2

0

For hosting web applications or services with long startup time in IIS 6.0 I always used simple console application which was pinging the web application. This application was run by windows scheduler every few minutes. It is not the nice solution but it was the easiest I found. If you are sure about AppPool recycling time, you can schedule such application to run few minutes after recycling and also add application to startup set.

Ladislav Mrnka
  • 360,892
  • 59
  • 660
  • 670
0

If you can update to IIS7, there is a built-in warm-up api. IIS: web applications warmup

Community
  • 1
  • 1
chilltemp
  • 8,854
  • 8
  • 41
  • 46
  • Thanks for your answer - but there is no chance to update to IIS 7 :-( – ceder Sep 02 '10 at 06:12
  • Bummer. Then I recommend that you check out the link I posted as a possible duplicate question. They have a bunch of alternatives for II6. – chilltemp Sep 02 '10 at 16:09