iis 缓存 静态文件
This might seem obvious to some folks, but to others it's not, so it's worth mentioning. Regardless, it's a good example of a "white box" attitude. Don't assume. Always assert your assumptions with good tests.
这在某些人看来似乎很明显,但在其他人看来却并非如此,因此值得一提。 无论如何,这是“白盒子”态度的一个很好的例子。 不要假设始终通过良好的测试来证明您的假设。
A client wanted to know how to 'force' a client to update some javascript that the browser had cached. The easy answer is "change the file."
客户端想知道如何“强制”客户端更新浏览器已缓存的一些JavaScript。 简单的答案是“更改文件”。
Here's what happens with a single HTML file and a single JavaScript file, running locally on my machine. The main directory is set to "Expire Immediately" via IIS's properties dialog. That means "keep it fresh."
这是在我的计算机上本地运行的单个HTML文件和单个JavaScript文件发生的情况。 通过IIS的属性对话框,主目录设置为“立即过期”。 那意味着“保持新鲜”。
Underneath the main directory is a directory called /js that is set to expire in 7 days, as seen at right.
如右图所示,主目录下面是一个名为/ js的目录,该目录设置为在7天后到期。
Here's an abridged HTTP Header view (via ieHttpHeaders) after hitting the page for the first time ever important stuff in bold.
这是有史以来第一次以粗体显示重要内容后的HTTP Header视图(通过ieHttpHeaders )。
GET /javascriptcachingtest/default.htm HTTP/1.1
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.1)
GET /javascriptcachingtest/default.htm HTTP / 1.1 用户代理:Mozilla / 4.0(兼容; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.1)
HTTP/1.1 200 OKServer: Microsoft-IIS/5.1
X-Powered-By: ASP.NET
Cache-Control: no-cacheExpires: Fri, 12 May 2006 19:03:59 GMT
Date: Fri, 12 May 2006 19:03:59 GMTContent-Type: text/html
Last-Modified: Fri, 12 May 2006 18:53:33 GMT
ETag: "b01be5ef575c61:df3"
Content-Length: 115
HTTP / 1.1 200 OK 伺服器:Microsoft-IIS / 5.1 X-Powered-by:ASP.NET 缓存控制:无缓存过期:格林尼治标准时间2006年5月12日19:03:59 日期:2006年5月12日星期五19:03:59 GMT 内容类型:text / html 上