目前我有缓存所有静态内容的clientCache Web.config缓存:
<staticContent>
<clientCache httpExpires="Sun, 29 Mar 2020 00:00:00 GMT" cacheControlMode ="UseExpires"/>
</staticContent>但我希望将favicon.ico从缓存中排除(或使其过期日期更短)。有没有办法实现它?
发布于 2011-09-04 06:44:56
尝试在<configuration>标记下添加<location>,指定它应该只应用于该文件--如下所示(这只是一个示例--取自实际工作配置的,其中favicon.ico与所有其他文件相比具有不同的过期时间):
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
...
<!-- your site config here -->
...
</system.webServer>
<location path="favicon.ico">
<system.webServer>
<staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="366.00:00:00" />
</staticContent>
</system.webServer>
</location>
</configuration>https://stackoverflow.com/questions/7294715
复制相似问题