2014-06-09 149 views
2

我有IIS7运行的现场,C#.NET 4,我已经使用web.config文件中的浏览器缓存设置为14天出于某种原因,我的.js和.css文件头返回此:杠杆浏览器缓存不缓存JavaScript和CSS文件

Cache-Control public,max-age=1209600, max-age=86400 

它同时传递14天,1天,同时与1日设置是压倒一切的价值。

有没有人有任何想法为什么会发生这种情况?

+0

您是否检查过http://serverfault.com/questions/346975/stop-iis-7-5-from-sending-out-cache-control-max-age-on-error-codes? –

回答

1

尝试通过system.webServer标记下的代码更新您的Web配置。

<caching> 
       <profiles> 

        <add extension=".js" policy="CacheUntilChange" kernelCachePolicy="DontCache" /> 
        <add extension=".css" policy="CacheUntilChange" kernelCachePolicy="DontCache" /> 

       </profiles> 
      </caching> 
      <staticContent> 
       <clientCache cacheControlCustom="public" 
      cacheControlMode="UseMaxAge" 
      cacheControlMaxAge="14.00:00:00" /> 
      </staticContent>