是否有可能在MVC JsonResult控制器方法使用的OutputCache?
-
20-09-2019 - |
题
我试图做到这一点,它会导致产生与contentlen 0
它看起来像:
[OutputCache(Duration = 36000)]
public JsonResult GetFileClasses()
{
return this.Json(TopicConfig.FileExtensionsSettings.List)
}
任何想法?
解决方案
在OutputCacheAttribute
还必须指定,VaryByParam
参数。否则,你会得到结果处理System.Web.HttpException: The directive or the configuration settings profile must specify the 'varyByParam' attribute.
此异常
你可以尝试添加该参数,看看它是否工作。
不隶属于 StackOverflow