网站需要部署后刷新生效 [英] Website needs force refresh after deploy
问题描述
从旧的网页部署网站从它的缓存新版本浏览器加载后的一切,直到力刷新完成。图像的时候,饼干是老了,一些AJAX的部分不工作。
After deploying a new version of a website the browser loads everything from its cache from the old webpage until a force refresh is done. Images are old, cookies are old, and some AJAX parts are not working.
我应该如何着手进行页面的最新版本,以服务用户部署后?
How should I proceed to serve the users with the latest version of the page after deploy?
的网页是用IIS7 +一个ASP.Net网页。
The webpage is an ASP.Net webpage using IIS7+.
推荐答案
您可以将变量附加到每个资源的与每个部署改变了尽头。例如,您可以命名您的样式表:
You can append a variable to the end of each of your resources that changes with each deploy. For example you can name your stylesheets:
styles.css?id=1
id为每次换水。
with the id changing each time.
这将迫使浏览器下载新的版本,因为它不能在它的缓存中找到它。
This will force the browser to download the new version as it cannot find it in its cache.
这篇关于网站需要部署后刷新生效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!