If you want to set the Cache-Control header, there's nothing in the IIS7 UI to do this, sadly.
You can however drop this web.config in the root of the folder or site where you want to set it:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="7.00:00:00" />
</staticContent>
</system.webServer>
</configuration>
That will inform the client to cache content for 7 days in that folder and all subfolders.
You can also do this by editing the IIS7 metabase via appcmd.exe
, like so:
Windowssystem32inetsrvappcmd.exe
set config "Default Web Site/folder"
-section:system.webServer/staticContent
-clientCache.cacheControlMode:UseMaxAge
Windowssystem32inetsrvappcmd.exe
set config "Default Web Site/folder"
-section:system.webServer/staticContent
-clientCache.cacheControlMaxAge:"7.00:00:00"
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…