DaveDev DaveDev - 6 months ago 100
ASP.NET (C#) Question

Is it possible to share HttpRuntime.Cache between multiple web servers?

We have a web application that is storing all the site data in


We now need to deploy the application across 2 load balanced web servers.

This being the case, each web server will have its own cache, which is not ideal because if a user requests data from webserver1 it will be cached, but there next request might go to webserver2, and the data that their previous request cached won't be available.

Is it possible to use a shared-cache provider to share the
between the two web servers or to replicate the cache between them, so that the same cache will be available on both web servers? If so, what can I do to solve this problem?


No, you can't share the built-in ASP.NET cache, but you could use something like memcached or AppFabric instead.