两个相关问题:使用IIS7默认的ETag策略时,为什么我们在浏览网页时看不到If-None-Match/304交互?
例如,对于空缓存请求返回的标头如下:
Content-Type image/png
Last-Modified Thu, 03 Dec 2009 15:51:56 GMT
Accept-Ranges bytes
Etag "a8a0628a3074ca1:0"
Server Microsoft-IIS/7.0
X-Powered-By ASP.NET
Date Tue, 22 Dec 2009 19:47:36 GMT
Content-Length 1780
为什么再次访问该页面时,图片不会生成304往返呢?
此外,IIS7的默认applicationHost文件如下(1):
<caching enabled="true" enableKernelCache="true">
</caching>
enableKernelCache='true' 是否适用于所有静态文件,使您无需显式注册扩展名即可授予内核策略(2)中的 CacheUntilChange ?
<caching>
<profiles>
<add extension=".gif" policy="DontCache" kernelCachePolicy="CacheUntilChange" duration="0.00:01:00" location="Any" />
<add extension=".png" policy="DontCache" kernelCachePolicy="CacheUntilChange" duration="0.00:01:00" location="Any" />
<add extension=".js" policy="DontCache" kernelCachePolicy="CacheUntilChange" duration="0.00:01:00" location="Any" />
<add extension=".css" policy="DontCache" kernelCachePolicy="CacheUntilChange" duration="0.00:01:00" location="Any" />
<add extension=".jpg" policy="DontCache" kernelCachePolicy="CacheUntilChange" duration="0.00:01:00" location="Any" />
<add extension=".jpeg" policy="DontCache" kernelCachePolicy="CacheUntilChange" duration="0.00:01:00" location="Any" />
</profiles>
</caching>
(1) %systemroot%\System32\inetsrv\config\applicationHost.config