亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

IIS7、iis7.5中禁止緩存單個(gè)靜態(tài)文件的配置方法

 更新時(shí)間:2017年02月26日 23:26:52   作者:桃子夭夭  
這篇文章主要介紹了IIS7、iis7.5中禁止緩存單個(gè)靜態(tài)文件的配置方法,需要的朋友可以參考下

IIS7中,想將一個(gè)經(jīng)常修改的靜態(tài)文件設(shè)置為不可緩存,在IIS配置界面里怎么也找不到...

一番google之后在stackoverflow里邊發(fā)現(xiàn)了這樣一段回答,最終解決了問(wèn)題:

一、單個(gè)文件的禁止緩存的方法

just stumbled across this question; you can use the following to disable the cache on a specific file:
偶爾看到這個(gè)問(wèn)題,你可以通過(guò)下面的方法來(lái)對(duì)單個(gè)文件進(jìn)行禁止緩存

<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)
注意路徑的寫(xiě)法需要相對(duì)于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;
或者是將這個(gè)文件放一個(gè)單獨(dú)的目錄里面,然后通過(guò)它自己的web.config文件來(lái)禁用緩存。

二、通過(guò)將文件放到一個(gè)目錄里面進(jìn)行設(shè)置,這個(gè)目錄里的文件都不會(huì)緩存

<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緩存也測(cè)試過(guò),不過(guò)你需要確認(rèn)他在Azure能否正常運(yùn)行。

相關(guān)文章

最新評(píng)論