IIS7啓用壓縮的操做以下圖:javascript
默認狀況下IIS7是啓用GZip壓縮的,可是有時候咱們會發現誰然啓用了壓縮可是一些js和css文件仍然沒有被壓縮,這個時候須要修改一下IIS 的配置文件:css
在C:\Windows\System32\inetsrv\config文件夾下找到applicationhost.config文件,打開以後找到以下一節內容:java
<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
<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="*/*" enabled="false" />
</dynamicTypes>
<staticTypes>
<add mimeType="text/*" enabled="true" />
<add mimeType="message/*" enabled="true" />
<add mimeType="application/javascript" enabled="true" />
<add mimeType="*/*" enabled="false" />
</staticTypes>
</httpCompression>
將:
<add mimeType="application/x-javascript" enabled="true" />
<add mimeType="text/css" enabled="true" />
加入到staticTypes節點,重啓IIS。