Setting ASP.Net PrivateBytesLimit Cache in C # Service

I have a C # service that is not an ASP.NET application but uses a singleton instance of the HttpRuntime class to cache elements in a cache element. Singleton is created as follows:

static private System.Web.HttpRuntime _httpRuntime = new HttpRuntime();

I want to set the maximum memory usage, so I have the following application configuration file: service.exe.config:

<configuration>
 <caching>
    <cache privateBytesLimit= "50000000"   privateBytesPollTime = "00:01:00"/>
 </caching>
</configuration>

This has no effect. Instead of setting it to 50 MB, when I look in HttpRuntime.Cache.EffectivePrivateBytesLimit, it is 720 MB.

What am I doing wrong?

+3
source share
1 answer

. , EffectivePrivateBytesLimit privateBytesLimit ( ASP.NET) ;

<configuration>
  <system.web>
    <caching>
      <cache privateBytesLimit="10000000" privateBytesPollTime="00:01:00" />
    </caching>
  </system.web>
</configuration>
+4

All Articles