How to turn on IIS7 output cache for WCF data serv

2019-07-13 16:26发布

I have a WCF data service which is sensitive to a quite sophisticated notion of parameters in terms of URL. The common case is having the URLs like http://host:port/DataServices/NavigationMetadataService.svc/Inventories('2.1.11.5')?$expand=Components,Items,Items/Properties,Items/Properties/Values (OData notion of parameters).

The service is supposed to return static data. This means that for one unique combination of parameters the response will always be the same (but its size is about 10-20 megabytes).

We’d like to enable the IIS7 output cache but we don’t know how to do this. IIS7 management console gives lack of opportunities to tune the output cache (only the name of the extension and “Vary by query string” parameter). Apparently here I don’t want to specify “.svc” in the “name of the extension” field because I want to enable the caching for only one WCF service.

There is an article about leveraging the ASP.NET output cache for the same purposes http://blogs.msdn.com/b/peter_qian/archive/2010/11/17/using-asp-net-output-caching-with-wcf-data-services.aspx . But actually it’s not about the IIS7 output cache.

We’d like to use IIS7 output cache because currently we’re testing the whole implementation under high load and choosing the best way of caching the responses. So practically we only need to compare the IIS7 output cache with ASP.NET output cache.

Am I missed something really obvious here? I’m quite new in WCF data services so please help

There is actually the similar question How do I cache WCF REST web service in IIS7? . But it is more likely about how to determine that the response is cache-worthy in terms of IIS7 output cache.

0条回答
登录 后发表回答