I've deployed an ASP.NET MVC app on IIS7 and Windows Server 2008.
I've read posts on here, and around the web, but can't get the darn client-side caching to work.
I'm trying to cache everything in the /Content folder. So far I've select that folder in IIS manager, and set the appropriate HTTP Response Headers (under Common Headers). I've also checked the web.config file in the /Content folder and the values there are being set.
All resources in /Content come back with this (from FireBug):
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
Note the Cache-Control and Expires values for this static image being requested.
The site is currently compiled in Debug (this will change), but surely that wouldn't make a difference?
Obviously I'm overlooking something, any ideas would be appreciated.
Thanks
If you can't get it working using the IIS admin tool, try Jeff Atwood's recommendation from 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>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.