1、IIS里要设置
2、C:/WINDOWS/system32/inetsrv/MetaBase.xml要设置
该文件很重要,请修改前先备份!
<IIsCompressionScheme Location ="/LM/W3SVC/Filters/Compression/deflate"
HcCompressionDll="%windir%/system32/inetsrv/gzip.dll"
HcCreateFlags="0"
HcDoDynamicCompression="TRUE"
HcDoOnDemandCompression="TRUE"
HcDoStaticCompression="FALSE"
HcDynamicCompressionLevel="9"
HcFileExtensions="htm
html
shtml
txt
js
css"
HcOnDemandCompLevel="10"
HcPriority="1"
HcScriptFileExtensions="aspx
ascx
asmx
ashx
asp
dll
exe"
>
</IIsCompressionScheme>
<IIsCompressionScheme Location ="/LM/W3SVC/Filters/Compression/gzip"
HcCompressionDll="%windir%/system32/inetsrv/gzip.dll"
HcCreateFlags="1"
HcDoDynamicCompression="TRUE"
HcDoOnDemandCompression="TRUE"
HcDoStaticCompression="TRUE"
HcDynamicCompressionLevel="9"
HcFileExtensions="htm
html
shtml
txt
js
css"
HcOnDemandCompLevel="10"
HcPriority="1"
HcScriptFileExtensions="aspx
ascx
asmx
ashx
asp
dll
exe"
>
</IIsCompressionScheme>
注意 蓝色的这些值,一定要每行一个,排在一行,用空格隔开是不行的。
正常保存的时候,因为IIS正在使用,应该会失败。需要先将IIS停止,再保存,然后再开启IIS。
命令:iisreset /stop
iisreset /start
3、到中国站长网检测检测
http://tool.chinaz.com/Gzips/