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

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

问题描述

在网站上运行 YSlow 插件后,我看到了其中一个 建议 是向脚本、样式表和图像添加远期过期标头.

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.

我想这样做,有人有这方面的经验吗?我正在使用 IIS 7,我阅读了 Microsoft 的文章,但对禁用 asp 缓存不感兴趣页面或图像,我实际上想强制缓存静态内容.此外,理想情况不存在于代码中,而是存在于 Web 服务器配置中.

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.

那么,要缓存每个图像、javascript 文件和样式表,我必须采取哪些步骤?

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

推荐答案

这可以在 IIS 6 中完成吗?

Can this be done in IIS 6?

配置内容过期

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

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

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

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

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

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