2014-09-11 57 views
6

我添加了下面一個在web.config中MVC客戶端緩存的靜態內容不工作

<staticContent> 
    <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="10.00:00:00" /> 
</staticContent> 

但我沒有看到到期響應頭。我應該做其他更改嗎?

enter image description here

+0

雖然我測試本地它不顯示。它在部署到測試服務器後顯示。 – user3194721 2014-09-11 18:16:18

回答

1

我將要做兩件事情調試。首先,我會從private改變cacheControlCustom到public

<location path="Content"> 
    <system.webServer> 
    <staticContent> 
     <clientCache 
      cacheControlCustom="public" 
      cacheControlMode="UseMaxAge" 
      cacheControlMaxAge="10.00:00:00" /> 
    </staticContent> 
    </system.webServer> 
</location> 

如果不工作檢查您的路徑覆蓋緩存的位置。您的示例沒有顯示該部分。

最後,試圖解開通過機器配置的StaticContent部分:

appcmd unlock config /section:staticContent 

下面是一些其他有用信息Client Cache的鏈接。