From: JMZ on
I have an ASP.net web service using WSE2 3.0. It uses the Application_Start
method in Global.asax.vb to cache a number of datasets. It works fine most of
the time, but we recently discovered that web.config changes dump the cache.

Is there anything else that causes the cache to be emptied (or reset)? Does
the runtime call Application_End() in Global.asax when the web.config is
changed?

Thanks in advance.
From: Brian Cryer on
"JMZ" <JMZ(a)discussions.microsoft.com> wrote in message
news:23D9D93F-7461-4E80-B1B8-0F31D5AAB718(a)microsoft.com...
>I have an ASP.net web service using WSE2 3.0. It uses the Application_Start
> method in Global.asax.vb to cache a number of datasets. It works fine most
> of
> the time, but we recently discovered that web.config changes dump the
> cache.

I had thought changes to web.config caused the application to recycle - but
if that were the case then Application_Start would get called again.

The framework is free to remove items from the cache whenever it needs to.
It is only a cache after all and not a permanent store. So you shouldn't
ever rely on something being available in the cache. If it matters that
items are being dumped from the cache then your application design is
wrong - but it shouldn't take much to fix it. Your logic should always test
to make sure you've pulled something back from the cache, and if not then
regenerate your dataset (and stick it back in the cache for next time).

> Is there anything else that causes the cache to be emptied (or reset)?
> Does
> the runtime call Application_End() in Global.asax when the web.config is
> changed?

Don't know about Application_End, I would assume that would be called should
the application recycle. I would doubt that it would be called if just the
cache were emptied.

In terms of application recycling, creating files in the application folder
can also cause recycling - although I think there are limits on how many
files before it recycles.

If it is application recycling which is causing you problems then (as well
as changing your caching logic) you might find it useful to look at the
web.config settings waitChangeNotification and maxWaitChangeNotification.

> Thanks in advance.

As an alternative, don't stick it in the cache but in the application
object. That way it should remain for the life of the application.

Hope this is useful.
--
Brian Cryer
http://www.cryer.co.uk/brian

 | 
Pages: 1
Prev: Uploads & uploadex.exe
Next: why cant stop a site