简体   繁体   English

如何在IIS7中缓存WCF REST Web服务?

[英]How do I cache WCF REST web service in IIS7?

When I turn on output caching for my service it doesn't appear to be cache-worthy in IIS. 当我为我的服务打开输出缓存时,它在IIS中似乎不值得缓存。 It really should be since I'm returning the same JSON content over and over. 确实应该这样,因为我一遍又一遍地返回相同的JSON内容。 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. VariantByQueryString选项似乎可以解决问题,但是由于我的资源是基于URI的,因此实际上并没有查询字符串,而只是资源的路径。 Has anyone successfully gotten IIS to output cache a WCF REST service? 有没有人成功获得IIS以输出缓存WCF REST服务?

After much digging using the FREB logs in IIS, my service is in fact cache-worthy. 在IIS中使用FREB日志进行大量挖掘之后,我的服务实际上是值得缓存的。 You can listen to the Cache events in IIS and it will show you exactly what is and is not caching. 您可以侦听IIS中的“缓存”事件,它将确切显示什么是缓存和不缓存。 I found this more helpful that using PerfMon. 我发现这比使用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. 输出缓存将起作用,并且实际上在事情变暖之后将在内存中立即提供内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM