I'm fixing a bug with ASP.NET OutputCache and it's driving me insane. We want caching on the server, but it does not appear to work (it did a while ago, in an older version of our app, but we discovered the bug by accident recently).
Locally, I just cannot get the caching to work on the server-side. Using this attribute:
[OutputCache(CacheProfile = "MyProfile", Location = OutputCacheLocation.Server)] // doesn't work
Now, based on a few things I've read by googling around, here is possibly relevant information:
- Output caching is enabled in IIS (localhost)
- I DO use an AuthorizeAttribute (a custom one with inheritance). I've debugged towards this specifically, and I'm 95% confident this is not the cause.
- I've fiddled around with various
VaryByParams
values, nothing works. - Caching does work client-side.
I've opened a perfmon
session and added some counters from the Web Service Cache
group, All I see is that there are cached URL's but the cache is missed:
The bigger problem/bug we're facing now is that OutputCache is not working at all right now. We were able to fix that by specifying VaryByParams=""
(an empty string). That did it for the client. But it doesn't work server-side yet.
I'm actually checking whether it works or not by placing a debug breakpoint in the action that should be cached. It gets hit everytime, which should mean the cache is not hit.