ASP.NET OutputCache varyByParam在Web.config中不起作用
发布时间:2020-12-16 07:06:12 所属栏目:asp.Net 来源:网络整理
导读:我试图缓存一些昂贵的生成图表.所以我在Web.config中这样做了: caching outputCacheSettings outputCacheProfiles !-- 4 hours : 60 sec x 60 min x 4 hour = 14400 sec -- add name="ChartCacheProfile" duration="14400" varyByParam="none" / /outputCac
我试图缓存一些昂贵的生成图表.所以我在Web.config中这样做了:
<caching> <outputCacheSettings> <outputCacheProfiles> <!-- 4 hours : 60 sec x 60 min x 4 hour = 14400 sec --> <add name="ChartCacheProfile" duration="14400" varyByParam="none" /> </outputCacheProfiles> </outputCacheSettings> </caching> 我在我的控制器中添加了这个: [OutputCache(CacheProfile="ChartCacheProfile")] public ActionResult GenerateChart() 但是这不起作用……,结果仍然没有被缓存,并且Action总是被执行.这可能需要1分钟才能完成. 请注意,每次都会使用不同的参数调用url.该参数与正在生成的图表无关.这就是我把varyByParam =“none”的原因. 解决方法
我怀疑它确实是一个错误.对我有用的是在OutputCache属性中显式设置VaryByParam:
[OutputCache(CacheProfile="ChartCacheProfile",VaryByParam="None")] public ActionResult GenerateChart() (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- 我可以通过编程方式从我的ASP.NET应用程序向IIS7中的动态IP
- .Net Core微服务入门全纪录(二)——Consul-服务注册与发现
- asp.net-mvc – 使用sqlserver express时不创建数据库的Ent
- 如何在Asp.net中调用webmethod C#
- asp.net – HttpMessageHandler与DelegatingHandler
- System.Net.ServicePointManager.DefaultConnectionLimit和
- asp.net – 如何在网格视图列标题上添加鼠标悬停工具提示
- asp.net-mvc-4 – 如何在Durandal中使用cshtml文件?
- c#初学-多线程中lock用法的经典实例
- 如何在asp.net中更改javascript警告框的标题?
推荐文章
站长推荐
- 如何在ASP.net中获取页面中的主页?
- asp.net-mvc-4 – 带ID的Html.Actionlink
- 动态填充DropDownList不会在回发ASP.net上保留值
- asp.net-mvc-3 – 最初未显示Telerik MVC Grid C
- asp.net – 通过链接按钮单击从一个用户控件到另
- asp.net – “与底层事务管理器的通信失败”错误
- ASP.NET MVC,GridViews,Calendars等的UI控件
- asp.net-mvc – MVC项目中的System.Globalizatio
- 让 .NET 轻松构建中间件模式代码
- dependency-injection – ActionFilterAttribute
热点阅读