Mar*_*cci 6 cache-control azure iis-7.5
我使用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>
Run Code Online (Sandbox Code Playgroud)
我的回复标题是:
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
Run Code Online (Sandbox Code Playgroud)
我在其中一个子文件夹中有一个额外的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>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
5673 次 |
最近记录: |