如何在IIS7中缓存WCF REST Web服务? [英] How do I cache WCF REST web service in IIS7?

查看:92
本文介绍了如何在IIS7中缓存WCF REST Web服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我为我的服务打开输出缓存时,它在IIS中似乎不值得缓存.确实应该这样,因为我一遍又一遍地返回相同的JSON内容. VariantByQueryString选项似乎可以解决问题,但是由于我的资源是基于URI的,因此实际上并没有查询字符串,而只是资源的路径.有没有人成功地让IIS输出缓存WCF REST服务?

When I turn on output caching for my service it doesn't appear to be cache-worthy in IIS. It really should be since I'm returning the same JSON content over and over. The varyByQueryString option seems like it would do the trick, but since my resources are URI based, there really isn't a query string, just a path to a resource. Has anyone successfully gotten IIS to output cache a WCF REST service?

推荐答案

在IIS中使用FREB日志进行大量挖掘之后,我的服务实际上是值得缓存的.您可以侦听IIS中的缓存"事件,它将确切显示什么是缓存和不缓存.我发现这比使用PerfMon更有用.我使用了按照链接进行设置.输出缓存可以正常工作,实际上可以在事情变暖之后立即在内存中为您的内容提供服务.

After much digging using the FREB logs in IIS, my service is in fact cache-worthy. You can listen to the Cache events in IIS and it will show you exactly what is and is not caching. I found this more helpful that using PerfMon. I used the following link to set it up. Output caching will work and will in fact serve your content right out of memory after things get warmed up.

这篇关于如何在IIS7中缓存WCF REST Web服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆