I have a WCF service hosted on IIS. Size of responses are quite big so I require a dynamic data compression that is enabled on IIS side (Service uses wsHttpBinding).
At some point I realize that I need caching of the compressed data too. Each of the requests to server is unique but return only one of few possible values. That means that I can't use IIS Caching because each request is different. On the other hand I can't use WCF caching because it doesn't know anything about IIS compressing, so we have to re-compress cached data over and over again.
Is there a way to work with a IIS compressed data cache from WCF/.net code? Any other known solutions?
Given that you say that your payload is large, I will assume that an extra round trip will add negligible latency. I would therefore suggest that you that you take full advantage of the fact that you are on HTTP.
Write a service behavior that detects that you are on HTTP. Then once you determine which of the large objects you are "returning", you intercept the return call, and replace it with a HttpContext.Response.Redirect()
.
Then write a separate service to host the ACTUAL results as a HTTP GET
with a deterministic URL.
The advantages you will get.
The pattern described here is HTTP redirection to a Canonical URL.
Simples!
PS Try to use the 303 redirect if possible