简体   繁体   English

ASP.NET静态内容始终缓存

[英]ASP.NET static content always caches

I have a project that uses ASP.NET MVC 5 and angular.js Recently (though I'm not sure when) changes to my angular.js views are not being reflected in the browser. 我有一个使用ASP.NET MVC 5和angular.js的项目最近(尽管我不确定何时)对我的angular.js视图所做的更改未反映在浏览器中。 When I look at the developer tools in Chrome, it indicates that it is pulling it directly from cache. 当我查看Chrome中的开发人员工具时,它表明它是直接从缓存中提取它。 The Last-Modified header appears to be a couple days old and the ASP.NET server is returning 304 Not Modified for the html file. Last-Modified标头似乎存在了几天,ASP.NET服务器针对html文件返回304 Not Modified。

Does anyone have any clue why my static content (specifically html files) are being cached by the browser when there are in fact changes. 有没有人有,为什么我的静态内容(特别是HTML文件)的浏览器的时候也实际上的变化被缓存的任何线索。

What I have tried: 我试过的

I have modified the Web.config like so: 我已经像这样修改了Web.config:

<system.webServer>
    ...
    <caching enabled="false" />
    <staticContent>
      <clientCache cacheControlMode="DisableCache"/>
    </staticContent>
</system.webServer>

However, that doesn't seem to make any difference. 但是,这似乎没有任何区别。 I have also checked that the file system is recognizing my changes; 我还检查了文件系统是否可以识别我的更改; the "date modified" on the files are much more recent than the "last-modified" being returned by the server. 文件上的“修改日期”比服务器返回的“最后修改”要新得多。

Response.Cache.SetCacheability(HttpCacheability.NoCache);

在后面的代码上尝试一下

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM