国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網站 > IIS > 正文

IIS7、iis7.5中禁止緩存單個靜態文件的配置方法

2024-08-29 03:16:32
字體:
來源:轉載
供稿:網友

IIS7中,想將一個經常修改的靜態文件設置為不可緩存,在IIS配置界面里怎么也找不到...

一番google之后在stackoverflow里邊發現了這樣一段回答,最終解決了問題:

一、單個文件的禁止緩存的方法

just stumbled across this question; you can use the following to disable the cache on a specific file:
偶爾看到這個問題,你可以通過下面的方法來對單個文件進行禁止緩存

<configuration> <location path="path/to/the/file">  <system.webServer>   <staticContent>    <clientCache cacheControlMode="DisableCache" />   </staticContent>  </system.webServer> </location></configuration>

(Note that the path is relative to the web.config file)
注意路徑的寫法需要相對于web.config文件的路徑
Alternatively, place the single file in a directory on it's own, and give that directory it's own web.config that disables caching for everything in it;
或者是將這個文件放一個單獨的目錄里面,然后通過它自己的web.config文件來禁用緩存。

二、通過將文件放到一個目錄里面進行設置,這個目錄里的文件都不會緩存

<configuration> <system.webServer>  <httpProtocol>   <customHeaders>    <add name="Cache-Control" value="no-cache" />   </customHeaders>  </httpProtocol> </system.webServer></configuration>

[Both tested on IIS7.5 on Windows 7, but you'll have to confirm that it works OK on Azure]
在win7中的iis7.5緩存也測試過,不過你需要確認他在Azure能否正常運行。

 

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 玉田县| 滨州市| 房产| 枣庄市| 酒泉市| 鲜城| 沧州市| 清河县| 卓尼县| 萨嘎县| 灵山县| 黑龙江省| 永清县| 河北省| 商洛市| 西华县| 武乡县| 贵南县| 上饶县| 平阳县| 兴化市| 平原县| 永年县| 长春市| 昌乐县| 乃东县| 称多县| 墨竹工卡县| 潍坊市| 翁牛特旗| 大兴区| 福泉市| 桦南县| 达州市| 多伦县| 和平县| 平江县| 灌南县| 上栗县| 行唐县| 镇雄县|