GZip compression by content type application / xhtml + xml not working in IIS 7.5 / MVC

I have an MVC3 site running on IIS 7.5 with compression enabled.

GZip compression works on all pages of the site, with the exception of several pages on which I manually change the type of content to application/xhtml+xml(this is necessary for various reasons) in the controller ( Response.ContentType = "application/xhtml+xml";).

What about this type of content, GZip will not work, and is there any way to do this?

+3
source share
1 answer

application/xhtml+xmlis not one of the built-in mime types that IIS compression knows for compression. You must enable compression for this mime type explicitly.

, , , . mime- system.webServer/httpCompression staticTypes dynamicTypes. script - appcmd.exe :

appcmd.exe set config -section:system.webServer/httpCompression /+"staticTypes.[mimeType='application/xhtml%%2bxml',enabled='True']" /commit:apphost

appcmd.exe set config -section:system.webServer/httpCompression /+"dynamicTypes.[mimeType='application/xhtml%%2bxml',enabled='True']" /commit:apphost

, , .

+3

All Articles