Ser*_*rge 7 .net asp.net-mvc caching outputcache asp.net-mvc-5
我是MVC的初学者,我有一个项目,从MVC2转换到最新版本的MVC.我读了一些关于MVC 4的书,所以我开始理解主要的机制.
但是,在转换我的MVC 2解决方案时,我遇到了一个属性问题:OutputCache.
通过例如.我有多个这样的动作(属性可能会有所不同):
[OutputCache(CacheProfile = "ProductImage")]
public ActionResult GetImage(Guid elementId, int imgtype)
Run Code Online (Sandbox Code Playgroud)
在Web.Config我有"缓存> outputCacheSettings> outputCacheProfiles>":
<add name="ProductImage" duration="5" varyByParam="elementId,imgtype" />
Run Code Online (Sandbox Code Playgroud)
并在输出中获取以下异常:
子操作的OutputCacheAttribute仅支持Duration,VaryByCustom和VaryByParam值.请不要为子操作设置CacheProfile,Location,NoStore,SqlDependency,VaryByContentEncoding或VaryByHeader值.
据我所知,问题只出现在儿童行动中.
| 归档时间: |
|
| 查看次数: |
3336 次 |
| 最近记录: |