views:

84

answers:

2

Hi,

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!

A: 

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
This is quite hacky isn't it? But its the only solution we found until now, too...
ceder
I'm also not happy with this solution but I have seen it on so many projects that I believe it is commonly accepted.
Ladislav Mrnka
A: 

If you can update to IIS7, there is a built-in warm-up api. http://stackoverflow.com/questions/2063461/iis-web-applications-warmup/2912865#2912865

chilltemp
Thanks for your answer - but there is no chance to update to IIS 7 :-(
ceder
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