脚本宝典收集整理的这篇文章主要介绍了IIS中User-mode caching引起的Cache-Control不为public问题的解决方法,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
web.config中对应的配置如下:
<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>
浏览器中看到的效果:
解决方法:
1、禁用User-mode caching,只用Kernel-mode caching。
2、在web.config中加上cacheControlCustom="public"
<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>
脚本宝典总结
以上是脚本宝典为你收集整理的IIS中User-mode caching引起的Cache-Control不为public问题的解决方法全部内容,希望文章能够帮你解决IIS中User-mode caching引起的Cache-Control不为public问题的解决方法所遇到的问题。
如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。