IIS7:缓存设置不起作用......为什么? [英] IIS7: Cache Setting Not Working... why?

查看:723
本文介绍了IIS7:缓存设置不起作用......为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的IIS7 web.config设置为以下静态资源文件夹(不在ASP.NET应用程序或任何内容中):

My IIS7 web.config is set to the following with a folder of static assets (not within an ASP.NET app or anything):

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <staticContent>
            <clientCache cacheControlCustom="public" cacheControlMode="UseMaxAge" cacheControlMaxAge="500.00:00:00" />
        </staticContent>
        <httpProtocol allowKeepAlive="false" />
    </system.webServer>
</configuration>

当我尝试访问Silverlight .XAP文件时,我希望IIS告诉浏览器它可以缓存500天。

When I try to access a Silverlight .XAP file, I expect IIS to tell the browser that it can be cached for 500 days.

但是,这是缓存标题:

Cache-Control:no-cache,public,max-age = 43200000

为什么IIS仍在添加 no-使用上面的配置文件缓存到此标头?

Why is IIS still adding no-cache to this header with the above configuration file?

推荐答案

您需要配置IIS来处理XAP作为静态内容。试试这个:

You need to configure IIS to treat XAP as static content. Try this:

<configuration>
   <system.webServer>
    <staticContent>
      <mimeMap fileExtension=".xaml" mimeType="application/xaml+xml" />
      <mimeMap fileExtension=".xap" mimeType="application/x-silverlight-app" />
      <mimeMap fileExtension=".xbap" mimeType="application/x-ms-xbap" />
    </staticContent>
   </system.webServer>
</configuration> 

这篇关于IIS7:缓存设置不起作用......为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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