源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

IIS中User-mode caching引起的Cache-Control不为public问题的解决方法

  • 时间:2020-05-19 22:02 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:IIS中User-mode caching引起的Cache-Control不为public问题的解决方法
[img]http://files.jb51.net/file_images/article/201311/20131122160139.jpg?2013102216541[/img] web.config中对应的配置如下:
[u]复制代码[/u] 代码如下:
<configuration>     <system.webServer>         <caching>             <profiles>                 <add extension=".css" policy="CacheUntilChange" kernelCachePolicy="CacheUntilChange" duration="00:00:30" />                 <add extension=".js" policy="CacheUntilChange" kernelCachePolicy="CacheUntilChange" duration="00:00:30" />             </profiles>         </caching>     </system.webServer> </configuration>
浏览器中看到的效果: [img]http://files.jb51.net/file_images/article/201311/20131122160224.jpg?201310221659[/img] [b]解决方法:[/b] [b]1、禁用User-mode caching,只用Kernel-mode caching。 [/b] [img]http://files.jb51.net/file_images/article/201311/20131122160242.jpg?2013102216621[/img] [b]2、在web.config中加上cacheControlCustom="public"[/b]
[u]复制代码[/u] 代码如下:
<configuration>     <system.webServer>         <staticContent>             <clientCache cacheControlCustom="public" cacheControlMode="UseMaxAge" cacheControlMaxAge="300.00:00:00" />         </staticContent>                <caching>             <profiles>                 <add extension=".css" policy="DontCache" kernelCachePolicy="CacheUntilChange" duration="30:00:30" />                 <add extension=".js" policy="DontCache" kernelCachePolicy="CacheUntilChange" duration="30:00:30" />             </profiles>         </caching>     </system.webServer> </configuration>
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部