IIS 7.5和图像未被缓存 [英] IIS 7.5 and images not being cached
本文介绍了IIS 7.5和图像未被缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我无法将图像文件缓存。我已尝试过在本网站和其他网站上找到的所有内容,但仍无法将其缓存。
I cannot get the image files to cache. I have tried everything that I have found on this site and others and still cannot get them to cache.
我尝试过的网络配置设置
Web config setting that I have tried
<staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="1.00:00:00" />
</staticContent>
<httpProtocol allowKeepAlive="true" />
<caching enabled="true" enableKernelCache="true">
<profiles>
<add extension=".png" policy="CacheUntilChange" />
<add extension=".jpg" policy="CacheForTimePeriod" duration="12:00:00" />
</profiles>
</caching>
以下是其中一张图片的回复标题
Here is the response headers for 1 of the images
Key Value
Response HTTP/1.1 200 OK
Cache-Control no-cache
Content-Type image/png
Last-Modified Thu, 16 Dec 2004 18:33:28 GMT
Accept-Ranges bytes
ETag "a1ca4bc9de3c41:0"
Server Microsoft-IIS/7.5
X-Powered-By ASP.NET
Date Fri, 18 May 2012 13:21:21 GMT
Content-Length 775
推荐答案
以下内容应使浏览器缓存您的图片:
The following should cause the browsers to cache your images:
<staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="1.00:00:00" />
</staticContent>
<httpProtocol>
<customHeaders>
<add name="Cache-Control" value="public" />
</customHeaders>
</httpProtocol>
< caching> ...< / caching>
block用于服务器端缓存,而不是客户端缓存。
The <caching>...</caching>
block is for server-side caching, not client side caching.
这篇关于IIS 7.5和图像未被缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文