添加过期或者缓存控制头在IIS静态内容 [英] Add Expires or Cache Control Header to static content in IIS

查看:345
本文介绍了添加过期或者缓存控制头在IIS静态内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在网站上运行 YSlow的插件后,我看到的建议是增加不远的将来到期头的脚本,样式表和图像。

我想做到这一点,没有任何人有这样的经历?我使用IIS 7和我读到了来自微软的文章,但我不感兴趣,禁用缓存ASP页面或图像,我其实要强制缓存静态内容。另外,理想的情况就不会在code存在,但在web服务器配置。

所以,我会采取什么步骤有每个图像,JavaScript文件和样式表缓存?

解决方案
  

可以这样在IIS 6中做了什么?

要设置内容过期

  1. 在Internet信息服务(IIS)管理器管理工具,用鼠标右键单击您的网站,然后单击属性。

  2. 在属性对话框中,HTTP标头选项卡上指定的过期时间,然后单击确定。

After running the YSlow plugin on a site, I saw that one of the recommendations was to add far future expires headers to the scripts, stylesheets, and images.

I would like to do this, does anyone have experience with this? I am using IIS 7 and I read an article from Microsoft but am not interested in disabling caching for asp pages or images, I actually want to force caching for static content. Also, the ideal situation would not exist in code, but in the web server configuration.

So, what steps would I have to take to have every image, javascript file, and stylesheet to be cached?

解决方案

Can this be done in IIS 6?

To configure content expiration

  1. In the Internet Information Services (IIS) Manager administrative tool, right-click Your Web Site, and then click Properties.

  2. In the Properties dialog box, on the HTTP Headers tab specify expiration time, and then click OK.

这篇关于添加过期或者缓存控制头在IIS静态内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆