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

编程入门 行业动态 更新时间:2024-10-25 18:36:33
本文介绍了添加过期或者缓存控制头在IIS静态内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

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

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

解决方案   

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

要设置内容过期

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

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

  • 更多推荐

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

    本文发布于:2023-10-31 19:13:47,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1547020.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:缓存   静态   内容   IIS

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!