我想要网站中的 gzip css 和 js 文件。并在 web.config 中使用此代码:
<system.webServer>
<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/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>
<urlCompression doStaticCompression="true" doDynamicCompression="true"/>
用 gtmetrix.com 网站分析我的网站,但得到:
Compressing the following resources with gzip could reduce their transfer size by 63.4KiB (77% reduction).
Compressing http://mysite.com/ could save 30.6KiB (74% reduction).
Compressing http://mysite.com/WebResource.axd?d=TdZvTxV1RZCMol6igoEA7XxfdqcWpTRlYuCxfymg_ruU4xc1NuSqLn7bduKh3WyPwSYX0g86d6fEJ3SVBdeWi5FBnMpKfcO7aaFoqvmTo_c1&t=634970873020000000 could save 17.5KiB (80% reduction).
Compressing http://mysite.com/main.css could save 14.8KiB (80% reduction).