Access to request HTTP headers in custom WCF MessageEncoder
Does anyone know how to get access to request HTTP headers within MessageEncoder.ReadMessage method? It seems that WCF already "knows" request headers at t开发者_JS百科he point of invoking ReadMessage method, at least Content-Type and Content-Length but I cannot get the access to the Content-Encoding header.
Basically, I'm trying to utilize gzip de/compression for WCF service (http://msdn.microsoft.com/en-us/library/ms751458.aspx) and would like to check if decompression is necessary for incoming request. To do that I'd like to check Content-Encoding header but cannot figure out where to get it. Any ideas?
Thanks!
Here's an answer I gave in another thread which explains how you would need to manipulate the headers via the WebOperationContext
in another IOperationBehavior
which is coupled with the MessageEncoder
.
精彩评论