我在IIS7的网站上使用Google Page Speed,我想知道如何设置
利用浏览器caching – 以下资源缺lesscaching过期
利用代理caching – 考虑将“caching控制:公共”标题添加到以下资源。
我在我的web.config中使用doDynamicCompression和有点困惑如何设置这些? 希望得到一些帮助
注意:引用正在使用http://www.iis.net/ConfigReference/system.webServer/httpCompression
我发现在我的一些testing中,我不必执行httpCompression选项,只需要urlCompression标记。
<configuration> <system.webServer> <urlCompression doDynamicCompression="true" /> </system.webServer> </configuration>
你可以通过浏览用户界面,并在那里设置选项,它会把上面的代码写到你的web.config中。 这是Site \ Compression“启用dynamic内容压缩”(静态选项通常默认启用)。
这同样适用于客户端caching,但IIS似乎只将其应用于静态内容。 这是在Site \ HTTP Response Headers \ Set Common Headers下,您可以启用Web内容到期。 或者web.config版本:
<system.webServer> <staticContent> <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="7.00:00:00" /> </staticContent> </system.webServer>
这设置了7天。 当谷歌的Page Speed FireFox插件结合使用时,它会停止抱怨压缩和浏览器caching。
要在ISS服务器中启用浏览器caching,您必须遵循以下说明:
1)login您的主机
2)findWeb.config
3)打开web.config
4)添加cacheControlMode给出的波纹pipe
5)保存web.config并检查caching。
<结构>
<system.webServer>
<staticContent>
<clientCache cacheControlMode =“UseExpires”httpExpires =“星期二,2038年1月19日03:14:07 GMT”/>
</ staticContent>
</system.webServer>
</configuration>