国产探花免费观看_亚洲丰满少妇自慰呻吟_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能否正常運行。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 五台县| 保定市| 乳源| 东光县| 巫山县| 江源县| 会理县| 清水河县| 宁武县| 晋城| 临汾市| 乡宁县| 兴安县| 麟游县| 车险| 合阳县| 汉阴县| 涞源县| 韩城市| 孙吴县| 房产| 马关县| 池州市| 裕民县| 亳州市| 红原县| 朝阳市| 南昌县| 巴青县| 长海县| 攀枝花市| 青龙| 和林格尔县| 安西县| 军事| 顺昌县| 东丰县| 清流县| 通许县| 武陟县| 仪征市|