azzlack / Microsoft.AspNet.WebApi.MessageHandlers.Compression

Drop-in module for ASP.Net WebAPI that enables GZip and Deflate support
Apache License 2.0
194 stars 54 forks source link

ObjectDisposedException - BaseServerCompressionHandler throws stream of response.Content has already been disposed. #34

Closed gentledepp closed 8 years ago

gentledepp commented 8 years ago

I am using this library in conjunction with AspNET Boilerplate. This is a very good framework for building websites based on .NET. One thing it does is to create the JQuery rest service proxies for Web API services. The problem with this feature is, that the response.Contents underlying stream has already been disposed, when BaseSErverCompressionHandler tries to compress it.

Simplest solution would be to catch the ObjectDisposedException and return the uncompressed response. That way the site remains functional at least.

azzlack commented 8 years ago

Thanks for the PR, will have a new version out soon