添加过期或者缓存控制头在IIS静态内容缓存、静态、内容、IIS

2023-09-02 21:09:54 作者:残雪

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

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

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

解决方案   

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

要设置内容过期

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

WEB优化技巧

在属性对话框中,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

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

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