【发布时间】:2011-11-02 17:31:02
【问题描述】:
我真的希望有人有一些想法。我已将我的网络配置设置为将图像缓存 30 天。
web.config:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<staticContent>
<clientCache cacheControlCustom="public" cacheControlMode="UseMaxAge" cacheControlMaxAge="30.00:00:00" />
</staticContent>
</system.webServer>
</configuration>
然而,当我使用 IE 请求页面并检查网络流量时,我看到的是:
Request Header:
Key Value
Request GET http://www.xx.com/Content/Icons/login.png HTTP/1.1
Accept image/png, image/svg+xml, image/*;q=0.8, */*;q=0.5
Referer http://www.selftestware.com/
Accept-Language en-US
User-Agent Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
Accept-Encoding gzip, deflate
Host www.xx.com
If-Modified-Since Wed, 24 Aug 2011 15:48:10 GMT
If-None-Match W/"0195d397562cc1:0"
Proxy-Connection Keep-Alive
Pragma no-cache
Cookie __utma=xx
Response:
Key Value
Response HTTP/1.1 200 OK
Cache-Control public,max-age=2592000
Content-Type image/png
Last-Modified Wed, 24 Aug 2011 15:48:10 GMT
Accept-Ranges bytes
ETag W/"0195d397562cc1:0"
Server Microsoft-IIS/7.5
X-Powered-By ASP.NET
Date Wed, 24 Aug 2011 10:39:14 GMT
Content-Length 727
它应该不发送 304(未修改)。我就是不明白这里出了什么问题。
【问题讨论】:
-
为什么会在请求头中看到“Pragma no-cache”??
-
这不是我设定的。我的应用程序是在 WIndows Azure 上运行的开箱即用的 MVC3 实现。
-
我认为你必须找到一种方法来删除它..!
-
在这种情况下,“pragma: no-cache”是一条红鲱鱼 - 我在请求标头中看到了这一点,但仍按预期得到 304 响应。
标签: asp.net html css asp.net-mvc iis-7