IIS Application Pool and Caching

I created an open list that runs and is accessible from my web application.

private static List<x> _x; static readonly object lockObjx = new object(); public static void XCache() { if (_x != null) return; lock (lockObjx) { _x = GetFromDatabase(); } } 

All this succeeds in the default application pool. Now I need to add a web service that can update this cache. Will I be able to do this in the default application pool? If not, then I can do this without installing something like MEMCache. Service and Wepp are running on the same server.

+1
source share
1 answer

To do this, you need to put the service in the same ASP.NET application as a web application. This usually means that they run on the same site in IIS.

Each ASP.NET application gets its own AppDomain. Each AppDomain has its own copy of all objects, including static links. In other words, data is not shared between AppDomain and therefore is not used by separate applications in IIS, even if they work in the same IIS process (AppPool).

There is a good article here: http://odetocode.com/Articles/305.aspx . It may be a little old, but it will still be valid.

+3
source

Source: https://habr.com/ru/post/1436702/


All Articles