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

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

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

  2021-03-20 我要评论
想了解IIS中User-mode caching引起的Cache-Control不为public问题的解决办法的相关内容吗,在本文为您仔细讲解IIS User-mode caching引起的Cache-Control不为public的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:IIS,Cache-Control,User-mode,下面大家一起来学习吧。




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>

猜您喜欢

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们