If you have an action that you call with RenderAction that has an attribute like this:
[OutputCache(CacheProfile="foo")]
and in web.config you've set up that profile to include the required VaryByParam and Duration attributes, the error message that will be reported is Duration cannot be less than or equal to 0.
The reason for this is that CacheProfile is not supported in a RenderAction scenario; nor are several other properties of OutputCacheAttribute. There is a check for this, and an associated exception, but it doesn't fire in the very common scenario where CacheProfile is used by itself. Rather, the check for Duration fires first, resulting in the misleading exception message.
This bug is fixed, with tests, in this pull request:
http://aspnetwebstack.codeplex.com/SourceControl/network/forks/ssmith/OutputCacheAttributeBugfix/contribution/4100
Comments: Pull request accepted: http://aspnetwebstack.codeplex.com/SourceControl/changeset/8b9832a12ec3 http://aspnetwebstack.codeplex.com/SourceControl/changeset/1c8fcf0e34ad
[OutputCache(CacheProfile="foo")]
and in web.config you've set up that profile to include the required VaryByParam and Duration attributes, the error message that will be reported is Duration cannot be less than or equal to 0.
The reason for this is that CacheProfile is not supported in a RenderAction scenario; nor are several other properties of OutputCacheAttribute. There is a check for this, and an associated exception, but it doesn't fire in the very common scenario where CacheProfile is used by itself. Rather, the check for Duration fires first, resulting in the misleading exception message.
This bug is fixed, with tests, in this pull request:
http://aspnetwebstack.codeplex.com/SourceControl/network/forks/ssmith/OutputCacheAttributeBugfix/contribution/4100
Comments: Pull request accepted: http://aspnetwebstack.codeplex.com/SourceControl/changeset/8b9832a12ec3 http://aspnetwebstack.codeplex.com/SourceControl/changeset/1c8fcf0e34ad