gpt4 book ai didi

azure - IIS 7.5 在缓存控制响应中添加了无缓存

转载 作者:行者123 更新时间:2023-12-04 15:46:35 24 4
gpt4 key购买 nike

我使用 Azure 和 IIS 7.5 来服务我的 Web 应用程序,但我没有使用 .NET。

我正在尝试覆盖静态文件的默认缓存控制值,但无论我指定什么,IIS 7.5 似乎都会添加无缓存

我的approot/web.config文件如下所示:

<?xml version="1.0"?>
<configuration>
<system.webServer>
...

<staticContent>
<clientCache cacheControlCustom="public" cacheControlMode="UseMaxAge" cacheControlMaxAge="30.00:00:00" />
</staticContent>
...

</system.webServer>
</configuration>

我的响应 header 是:

Accept-Ranges:bytes
Access-Control-Allow-Origin:*
Cache-Control:no-cache,public,max-age=2592000
Content-Encoding:gzip
Content-Length:4309
Content-Type:application/x-javascript
Date:Mon, 10 Sep 2012 14:42:07 GMT
ETag:"8ccd2f95a8fcd1:0"
Last-Modified:Mon, 10 Sep 2012 13:48:36 GMT
Server:Microsoft-IIS/7.5
Vary:Accept-Encoding
X-Powered-By:ASP.NET

我的子文件夹之一中确实有一个额外的 web.config 文件,但它不会覆盖任何 clientCache 值。

有人知道为什么 IIS 会在前面加上无缓存吗?

谢谢!

最佳答案

显然,输出缓存需要一个位置属性,否则它将覆盖 staticContent/clientCache 设置。

<system.webServer>
...
<caching>
<profiles>
<add extension="*" policy="CacheForTimePeriod" duration="00:01:00" varyByQueryString="*" varyByHeaders="X-Requested-With" location="Any" />
</profiles>
</caching>
...
</system.webServer>

关于azure - IIS 7.5 在缓存控制响应中添加了无缓存,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12355270/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com