Reputation:
I have been playing with the "applicationHost.config" file in "C:\Windows\System32\inetsrv\config" directory, so far so good, I just want to make sure of something:
<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
<scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />
<staticTypes>
......
</staticTypes>
<dynamicTypes>
......
<add mimeType="application/json" enabled="true" />
<add mimeType="*/*" enabled="false" />
</dynamicTypes>
As you can see, I added the line <add mimeType="application/json" enabled="true" />
. Will this ensure only dynamic Ajax calls using jquery will be compressed? I am calling my ASP.NET Page Methods using:
$.ajax({
type: "POST",
url: 'someur.aspx/someMethod',
contentType: "application/json; charset=utf-8",
.....
Am I correct?
Upvotes: 1
Views: 1059
Reputation: 11227
you need to add 2 content types to enable dynamic compression for JSON:
<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
<scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />
<dynamicTypes>
<add mimeType="application/json" enabled="true" />
<add mimeType="application/json; charset=utf-8" enabled="true" />
<!-- all other MIME type come here -->
<add mimeType="*/*" enabled="false" />
</dynamicTypes>
</httpCompression>
Upvotes: 1