how to enable iis 7 dynamic content compression?

Solution 1:

You can follow the troubleshooting steps mentioned here.. HTTP COMPRESSION in IIS 6 and IIS 7 using Service Account

Solution 2:

"Content-Endcoding: chunked" should never appear in a server response. "Chunked" is a separate part of the HTTP spec entirely, "Transfer-Encoding". You should be looking for "Content-Encoding: gzip", potentially in addition to "Transfer-Encoding: chunked". Here is an example from Google's home page:

HTTP/1.1 200 OK
Content-Type: text/html; charset=UTF-8
Date: Wed, 17 Feb 2010 13:43:22 GMT
Expires: Wed, 17 Feb 2010 13:43:22 GMT
Cache-Control: private, must-revalidate, max-age=0
Last-Modified: Wed, 17 Feb 2010 13:43:22 GMT
Server: igfe
Transfer-Encoding: chunked
Content-Encoding: gzip

Now, as far as debugging your issue goes, IIS7 compresses based on content-type. So when it sees "Content-Type: text/html", it compresses the page. So first, make sure your scripts are returning a content-type that IIS sees as compressible (text/*).

Also, IIS will not compress the page by default for an HTTP/1.0 request (used by some proxies such as Squid) or headers which indicate that the request came from a proxy server (Via: or X-Forwarded-For:). This is a conservative default to deal with the large number of older proxies out there that don't handle compressed HTTP content properly. You can override this behavior by editing IIS configuration files (either at the server or site level).

Finally, make sure your client is sending "Accept-Encoding: gzip" headers on the request. If it is a standard browser, it will by default, but if you are using wget or some other tool it may not. You can use Fiddler to see the entire HTTP conversation, including headers and data.