Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-core/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iis 7 IIS7上CSS文件的设置缓存不起作用_Iis 7_Cache Control - Fatal编程技术网

Iis 7 IIS7上CSS文件的设置缓存不起作用

Iis 7 IIS7上CSS文件的设置缓存不起作用,iis-7,cache-control,Iis 7,Cache Control,我试图实现谷歌Pagespeed关于浏览器缓存的建议(在静态内容上设置过期器或缓存控制头)。 在阅读了这里(比如)和其他网站上的许多帖子后,我似乎不明白为什么Pagespeed仍然不赞成我的CSS文件 例如:。根据本地PageSpeed,但根据联机PageSpeed测试,此文件的过期时间为1天 My web.config: <caching> <profiles> <add extension=".css" policy="CacheUntilChan

我试图实现谷歌Pagespeed关于浏览器缓存的建议(在静态内容上设置过期器或缓存控制头)。 在阅读了这里(比如)和其他网站上的许多帖子后,我似乎不明白为什么Pagespeed仍然不赞成我的CSS文件

例如:。根据本地PageSpeed,但根据联机PageSpeed测试,此文件的过期时间为1天

My web.config:

 <caching>
  <profiles>
    <add extension=".css" policy="CacheUntilChange" 
     kernelCachePolicy="CacheUntilChange" location="Any" />
  </profiles>
 </caching>
 <httpProtocol>
 <customHeaders>
   <add name="Cache-Control" value="public" />
 </customHeaders>
 </httpProtocol>
 <staticContent>
   <clientCache cacheControlMode="UseMaxAge" cacheControlCustom="max-age"
    cacheControlMaxAge="1.00:00:00" />
 </staticContent>


有人看到我在正确设置Expires标题时遗漏了什么吗?

我自己也一直在努力解决这个问题。然而,我找到了一个解决方案:

<httpProtocol>
    <customHeaders>
        <add name="Cache-Control" value="max-age=2592000" />
    </customHeaders>
</httpProtocol>

这就是全部。上述代码中的值,
“最大年龄=2592000”
,为1个月