I find it hard to get IIS 7 to properly compress the Json result from ASP.NET MVC. I have enabled static and dynamic compression in IIS. I can verify with Fiddler that plain text / html and similar entries are compressed. When viewing the request, the gzip accept-encoding header is present. The response has mimetype "application / json" but is not compressed.
I found that the problem is related to MimeType. When I turn on mimeType="*/*" , I see that the answer is correctly gzipped. How do I get IIS to compress without using wildcard mimeType? I assume this issue has something to do with how ASP.NET MVC generates content type headers.
CPU utilization is well below the dynamic throttling threshold. When I look at the trace logs from IIS, I see that it is not compressed due to the lack of a suitable mime type.
<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files" noCompressionForProxies="false"> <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" /> <dynamicTypes> <add mimeType="text/*" enabled="true" /> <add mimeType="message/*" enabled="true" /> <add mimeType="application/x-javascript" enabled="true" /> <add mimeType="application/json" enabled="true" /> </dynamicTypes> <staticTypes> <add mimeType="text/*" enabled="true" /> <add mimeType="message/*" enabled="true" /> <add mimeType="application/x-javascript" enabled="true" /> <add mimeType="application/atom+xml" enabled="true" /> <add mimeType="application/xaml+xml" enabled="true" /> <add mimeType="application/json" enabled="true" /> </staticTypes> </httpCompression>
Gareth Saul Jan 26 2018-10-10T00: 00-01
source share