2

我正在使用PageSpeed Insights在我的 asp.net 应用程序中进行页面优化,发现我需要将所有请求压缩为 Gzip 格式以减少大小和加载时间。

但是,当我检查网络中的请求时,它显示在Request-headerResponse-Header中已经分别有Accept-Encoding:gzip、deflate、sdchContent-Encoding:gzip。这意味着编码会自动发生在 aspx 页面上!

这是怎么发生的?是默认的吗?

对于 js 和 css 没有编码,在PageSpeed Insights中它告诉我你需要在高优先级部分压缩所有jscss 。我怎样才能为我的 asp.net 应用程序实现它?

4

1 回答 1

1

IIS 能够为您进行 gzip 压缩,下面的示例进入您的 web.config

<system.webServer>
    <!-- enable gzip compression -->
    <urlCompression doStaticCompression="true" doDynamicCompression="true" dynamicCompressionBeforeCache="true" />
</system.webServer>
于 2012-07-16T02:27:39.063 回答