IIS7 + ASP.NET MVC客户端缓存头不工作

问题描述:

我已经部署IIS7和Windows Server上的ASP.NET MVC应用程序2008IIS7 + ASP.NET MVC客户端缓存头不工作

我在这里读的帖子,和网络上,但可以不会让客户端缓存工作。

我试图缓存/ Content文件夹中的所有内容。到目前为止,我已经在IIS管理器中选择了该文件夹,并设置了相应的HTTP响应头(在Common Headers下)。我还检查了/ Content文件夹中的web.config文件,并且正在设置值。

在/内容的所有资源回来与此(从萤火虫):

Cache-Control no-cache, no-store, must-revalidate 
Pragma  no-cache 
Content-Type image/png 
Expires  -1 
Last-Modified Sun, 11 Oct 2009 19:01:40 GMT 
Accept-Ranges bytes 
Etag   "f318d643a54aca1:0" 
Server  Microsoft-IIS/7.0 
X-Powered-By ASP.NET 
Date   Sun, 11 Oct 2009 20:40:01 GMT 
Content-Length 620 

注意Cache-Control和对被请求该静态图像过期值。

该网站目前编译在调试(这将改变),但肯定这没有什么区别?

显然我忽视了一些东西,任何想法将不胜感激。

感谢

如果你不能得到它的工作使用IIS管理工具,尝试从 this thread杰夫·阿特伍德的建议:

<?xml version="1.0" encoding="UTF-8"?> 
<configuration> 
    <system.webServer> 
    <staticContent> 
     <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="7.00:00:00" /> 
    </staticContent> 
    </system.webServer> 
</configuration>