I am trying to enable HttpCompression for Json
files, but the system.WebServer/httpCompression
is missing from the configuration editor options in IIS.
I have the configuration applied in the Web.Config
of my site, and it works fine in my development computer (Windows 10 - IIS 10), but when deployed to the test server it doesn't work.
These are our Web.config
settings:
<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files" staticCompressionIgnoreHitFrequency="true" dynamicCompressionDisableCpuUsage="70" dynamicCompressionEnableCpuUsage="50">
<remove name="gzip" />
<scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" staticCompressionLevel="9" dynamicCompressionLevel="4" />
<dynamicTypes>
<remove mimeType="text/*" />
<remove mimeType="message/*" />
<remove mimeType="application/javascript" />
<remove mimeType="application/json" />
<remove mimeType="image/svg+xml" />
<remove mimeType="*/*" />
<add mimeType="text/*" enabled="true" />
<add mimeType="message/*" enabled="true" />
<add mimeType="application/javascript" enabled="true" />
<add mimeType="application/json" enabled="true" />
<add mimeType="image/svg+xml" enabled="true" />
<add mimeType="*/*" enabled="false" />
</dynamicTypes>
<staticTypes>
<remove mimeType="text/*" />
<remove mimeType="message/*" />
<remove mimeType="application/javascript" />
<remove mimeType="application/xml" />
<remove mimeType="image/svg+xml" />
<remove mimeType="*/*" />
<add mimeType="text/*" enabled="true" />
<add mimeType="message/*" enabled="true" />
<add mimeType="application/javascript" enabled="true" />
<add mimeType="application/xml" enabled="true" />
<add mimeType="image/svg+xml" enabled="true" />
<add mimeType="*/*" enabled="false" />
</staticTypes>
</httpCompression>
<urlCompression doStaticCompression="true" doDynamicCompression="true" />
<serverRuntime frequentHitThreshold="1" frequentHitTimePeriod="00:00:05" />
I already ran the commands to unlock the corresponding sections:
%systemroot%\system32\inetsrv\APPCMD unlock config /section:httpCompression
%systemroot%\system32\inetsrv\APPCMD unlock config /section:serverRunTime
We have the Static and Dynamic Content Compression features are installed.
What are we missing? Why is the HttpCompression option missing in the Configuration Editor of the site? Why is not compressing our json files on the server?
Update We could figure out part of the issue. We were editing the apphost.config file with Notepad++ and because of the issue described in this post it seemed we were editing the right file, but we really weren't. It is an issue from the conflict of editing files with a 32 bits application. However it seems the issue no longer exist in Windows 10.
We edited the applicationHost.config file with Notepad and the HttpCompression option started to show in IIS Manager, but it is still not working.