ハックですが、リフレクションを使用してクラスにプライベートフィールドをContent-Length
設定することで、リクエストが解凍された後でも、オリジナルを使用して WCF を回避できます。Joannes Vermorel のコードを使用する:_contentLength
HttpRequest
void BeginRequest(object sender, EventArgs e)
{
var app = (HttpApplication)sender;
if ("gzip" == app.Request.Headers["Content-Encoding"])
{
app.Request.Filter = new GZipStream(
app.Request.Filter, CompressionMode.Decompress);
// set private _contentLength field with new content length after the request has been decompressed
var contentLengthProperty = typeof(HttpRequest).GetField("_contentLength", BindingFlags.NonPublic | BindingFlags.Instance);
contentLengthProperty.SetValue(app.Request, (Int32)app.Request.InputStream.Length);
}
}