"使用无效响应滤波器QUOT的;当从IHttpHandler的COM pressing响应 [英] "Invalid use of response filter" when compressing response from an IHttpHandler
问题描述
我有一个IHttpHandler的返回一个文件。当响应流为com pressed,既可以自动使用Telerik的RADCOM pression或通过明确设置过滤器
I have an IHttpHandler returning a file. When the response stream is compressed, either automatically using Telerik RadCompression or by explicitly setting a filter using
context.Response.Filter = new GZipStream(context.Response.Filter, CompressionMode.Compress);
返回到浏览器的响应是正确的,但在反应的末尾是一些HTML。该HTML包含异常:
the response returned to the browser is correct but at the end of the response is some HTML. The HTML contains the exception:
[HttpException (0x80004005): Invalid use of response filter]
System.Web.HttpResponseStreamFilterSink.VerifyState() +3928894
System.Web.HttpResponseStreamFilterSink.Write(Byte[] buffer, Int32 offset, Int32 count) +28
System.IO.Compression.DeflateStream.Dispose(Boolean disposing) +363
System.IO.Stream.Close() +28
System.IO.Compression.GZipStream.Dispose(Boolean disposing) +63
System.IO.Stream.Close() +28
System.IO.Compression.DeflateStream.Dispose(Boolean disposing) +595
System.IO.Stream.Close() +28
System.IO.Compression.GZipStream.Dispose(Boolean disposing) +63
System.IO.Stream.Close() +28
System.Web.HttpWriter.FilterIntegrated(Boolean finalFiltering, IIS7WorkerRequest wr) +754
System.Web.HttpResponse.FilterOutput() +121
System.Web.CallFilterExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +174
如果我要确保响应不COM pressed,响应包含也不例外。
If I make sure the response is NOT compressed, the response contains no exception.
什么与了?
推荐答案
这似乎与此有关:<一href=\"http://stackoverflow.com/questions/3653250/gzipstream-is-cutting-off-last-part-of-xml\">GZipStream被切断XML 的最后一部分
It seems to be related to this: GZipStream is cutting off last part of XML
我删除了COM pression模块,它似乎是所有好现在。
I removed the compression module and it seem to be all good now.
这篇关于&QUOT;使用无效响应滤波器QUOT的;当从IHttpHandler的COM pressing响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!