简体   繁体   English

IIS 更新重置浏览器

[英]IIS Update reset browser

I wanted to know if there is a way to reset browser cache once I update web server with new code?我想知道用新代码更新 web 服务器后是否有办法重置浏览器缓存? I have JavaScript that is I want to make sure they user has the most update version.我有 JavaScript,我想确保他们的用户拥有最新版本。

In IIS you can change the Content Expiry Header to force the client to get the latest versions of the files.在 IIS 中,您可以更改内容到期 Header 以强制客户端获取文件的最新版本。

  1. Open IIS Manager, select your site.打开 IIS 经理,select 您的站点。

  2. From the middle pane double click on the HTTP Response Headers .在中间窗格中双击HTTP Response Headers

在此处输入图像描述

3)On the HTTP Response Headers page, in the Actions pane, click Set Common Headers. 3) 在 HTTP Response Headers 页面上,在 Actions 窗格中,单击 Set Common Headers。

4)In the Set Common HTTP Response Headers dialog box, select the Expire Web content checkbox and select one of the following options: 4)In the Set Common HTTP Response Headers dialog box, select the Expire Web content checkbox and select one of the following options:

  • Select Immediately if you want the content to expire immediately after it is sent in a response. Select如果您希望内容在响应中发送后立即过期,则立即生效。

  • Select After if you want the content to expire periodically. Select如果您希望内容定期过期。 Then, in the corresponding boxes, type an integer and select a time interval at which content expires.然后,在相应的框中,键入 integer 和 select 内容到期的时间间隔。 For example, type 1 and select Days if you want the content to expire daily.例如,如果您希望内容每天过期,请键入 1 和 select Days。

  • Select On (in Coordinated Universal Time (UTC)) if you want the content to expire on a specific day and at a specific time. Select 如果您希望内容在特定日期和特定时间到期,则开启(采用协调世界时 (UTC))。 Then, in the corresponding boxes, select a date and time at which the content expires.然后,在相应的框中,select 内容到期的日期和时间。

在此处输入图像描述

If you have access to the source code all modern browsers will treat resources such as a CSS, Javascript as new versions if you append a query string to them which is unique.如果您可以访问源代码,那么所有现代浏览器都会将 CSS、Javascript 等资源视为新版本,如果您对它们提供一个唯一的查询字符串 append。

Eg例如

http://example.com/test.js?v=1.1 http://example.com/test.js?v=1.1

The actual content of the query string doesn't matter as long as it's unique, however, most developers will tend to use v for version and then just set it to be the build number.查询字符串的实际内容并不重要,只要它是唯一的,然而,大多数开发人员倾向于使用 v 表示版本,然后将其设置为内部版本号。

暂无
暂无

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

相关问题 IIS 7.5上的MVC 4应用程序中的请求长度ERR_CONNECTION_RESET - Request Length ERR_CONNECTION_RESET in MVC 4 Application on IIS 7.5 IIS更新应用程序性能的第一个请求 - IIS Update An Application Performance First Request 我无法在 IIS 的虚拟目录中显示/浏览我的图像 - I can't display/browser my images in Virtual Directory in IIS IIS 网站:尝试在浏览器中访问网站时出错(Kestrel 问题) - IIS website : error trying to access site in browser (Kestrel problem) 在本地PC上,IIS和浏览器使用大结果集来最大化CPU - On local PC IIS and Browser maxes out CPU with large result set ASP.NET MVC网站在任何浏览器上都被重定向到本地IIS而不是IIS express - ASP.NET MVC website getting redirected to local IIS instead of IIS express on any browser 在Visual Studio中进行调试时,在浏览器中使用本地IIS服务器而不是IIS EXPRESS会收到“访问被拒绝”消息 - When debugging in Visual Studio I get message 'Access is denied' in the browser with Local IIS Server NOT with IIS EXPRESS 重新部署asp.net Web API / MVC应用程序而无需iis重置 - Redeploy asp.net web api/ mvc app without iis reset IIS 应用程序池标识权限在每个 Visual Studio 应用程序发布时重置 - IIS Application Pool Identity permissions reset on every Visual Studio app Publish 当配置发生更改时Log4Net可以工作,但是IIS重置会使其停止工作 - Log4Net works when a config change happens, but IIS Reset stops it working
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM