Additional answer for partial views (only)
Partial views don't like the NoStore or Duration of 0 settings.
You get Additional information: OutputCacheAttribute for child actions only supports Duration, VaryByCustom, and VaryByParam values. Please do not set CacheProfile, Location, NoStore, SqlDependency, VaryByContentEncoding, or VaryByHeader values for child actions. Additional information: OutputCacheAttribute for child actions only supports Duration, VaryByCustom, and VaryByParam values. Please do not set CacheProfile, Location, NoStore, SqlDependency, VaryByContentEncoding, or VaryByHeader values for child actions. for NoStore and another error that Duration must be positive if you set Duration=0
Fix for partial views (compatible with normal views):
[OutputCache(Duration = 1, VaryByParam = "*")]
This is cached for no more than one second, which should be normal for normal operations.
source share