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

首頁 > 網站 > IIS > 正文

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

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

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能否正常運行。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 抚宁县| 锡林浩特市| 舒城县| 贵州省| 龙川县| 应城市| 明水县| 武威市| 台北市| 驻马店市| 河北区| 喀喇沁旗| 德清县| 齐河县| 安达市| 满城县| 明光市| 平江县| 孝感市| 湟源县| 百色市| 江都市| 前郭尔| 桃江县| 隆子县| 海城市| 阿坝县| 乡宁县| 五大连池市| 资溪县| 南川市| 甘谷县| 南岸区| 大埔县| 将乐县| 乌兰浩特市| 石河子市| 恩平市| 扎赉特旗| 改则县| 浮山县|