I had to render a json feed. Since the size of the feed is around 10 MB, I decided to enable compression in ASPNET. I enabled dynamic compression for json mime type. Compression works well and reduced the size to 1 MB (significant compression benefit for server CPU utilized).
But wierdly, the browser took 2.6 mins each time and failed though I see JSON received in few seconds.
I tried to debug with fiddler and inspection tools. I see chunked transfer encoding in response. So the browser waits for about 150 seconds to receive 0 sized chunk to complete.
I don't flush response in any of the json service. So IIS enables chunked transfer in this case. Turning off enableChunkedEncoding didn't help either.
How do I get this compression working or compression + chunked transfer work together?
Here are the request and response headers.
Request Headers
Request URL:http://localhost:8080/Default2.aspx
Request Method:GET
Status Code:200 OK
Accept-Encoding:gzip,deflate,sdch
Response Headers
Content-Encoding:gzip
Content-Type:application/json; charset=utf-8
Transfer-Encoding:chunked
Edited: Interestingly, everything works fine when compressed response is < 1 MB. Issue creeps in when response is > 1 MB. I created test project here
Thanks In Advance