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

时间:2022-10-30 23:19:13

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中似乎不值得缓存。应该是这样的,因为我一次又一次地返回相同的JSON内容。varyByQueryString选项看起来很有用,但是由于我的资源是基于URI的,所以实际上没有查询字符串,只有资源的路径。有没有人成功地让IIS将一个WCF REST服务输出到缓存中?

1 个解决方案

#1


0  

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.

在使用IIS中的FREB日志进行大量挖掘之后,我的服务实际上是值得缓存的。您可以侦听IIS中的缓存事件,它将显示哪些是缓存,哪些不是缓存。我发现使用PerfMon更有帮助。我使用以下链接来设置它。输出缓存会起作用,并且在事情预热之后,实际上会使你的内容从内存中恢复。

#1


0  

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.

在使用IIS中的FREB日志进行大量挖掘之后,我的服务实际上是值得缓存的。您可以侦听IIS中的缓存事件,它将显示哪些是缓存,哪些不是缓存。我发现使用PerfMon更有帮助。我使用以下链接来设置它。输出缓存会起作用,并且在事情预热之后,实际上会使你的内容从内存中恢复。