IIS7启用静态压缩

IIS7启用压缩的操作如下图:

 

默认情况下IIS7是启用GZip压缩的,但是有时候我们会发现谁然启用了压缩但是一些js和css文件仍然没有被压缩,这个时候需要修改一下IIS 的配置文件:

在C:WindowsSystem32inetsrvconfig文件夹下找到applicationhost.config文件,打开之后找到如下一节内容:

<httpCompression directory="%SystemDrive%inetpub	empIIS Temporary Compressed Files">
<scheme name="gzip" dll="%Windir%system32inetsrvgzip.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。
原文地址:https://www.cnblogs.com/miaochw/p/3601653.html