torsdag 18 oktober 2007

ASP.NET Cache gets flushed, cleared or randomly disappear

Have you been having problems with the ASP.NET cache gets cleared, flushed or simply seems to disappear when running your ASP.NET 2.0 web application? Restarting the IIS seems to help for a while but eventually the cache gets flushed again.

This problem seem to appear especially computers with 2GB of ram or less.

The solution is quite simple, and should be good enough on a developing machine. Simply add the following lines in web.config in the .



 1: <caching> 

 2: <cache disableMemoryCollection = "true"

 3: disableExpiration = "false" 

 4: privateBytesLimit = "0" 

 5: percentagePhysicalMemoryUsedLimit = "90" 

 6: privateBytesPollTime = "00:02:00"/> 

 7: </caching>





There are a few tools that might be helpful when debugging cache.

Reference:

Thanks to Henrik for good google skills.

Inga kommentarer: