I can't seem to get IIS on Windows 2012 R2 to cache a large .exe file. That is, when I constantly request the file I see the file being read constantly in in Resource Monitor, and running
netsh http show cachestate
does not show the file cached.
I think I've configured the system to cache .exe files for the folder in the kernel and to not have a max file size. The total cache size limit is 0, which I understand will make the system use up to half of all memory. The server has 6 GB of RAM, with lots of it free.
That is, in the Output Cache settings for the root of the web server:
- Maximum cached response size (in bytes) = 0 (also reflected in applicationHost.config's maxResponseSize value)
- Cache size limit (in MB) is not checked (also in applicationHost.config maxCacheSize = 0)
- Enable cache and Enable kernel cache are checked (both set to true in applicationHost.config
I'm serving the file from a virtual folder configured to be a 4.0 ASP.NET application. 4.6.2 is installed. The virtual folder points to a UNC share that is on the same system. (I know I could point to the local file system; I'm simulating hosting files that are on another system.)
The web.config file:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<clear />
<add name="StaticFile" path="*" verb="*" modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule" resourceType="Either" requireAccess="Read" />
</handlers>
<caching>
<profiles>
<add extension=".txt" policy="CacheUntilChange" kernelCachePolicy="CacheUntilChange" />
<add extension=".exe" policy="CacheUntilChange" kernelCachePolicy="CacheUntilChange" />
</profiles>
</caching>
</system.webServer>
</configuration>
It will cache small .txt and .exe files (about 20 bytes each).
What am I missing that's preventing IIS from caching the large file?