IIS7:缓存设置不起作用......为什么?

Bra*_*don 2 silverlight iis-7 cache-control browser-cache

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

<?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>
Run Code Online (Sandbox Code Playgroud)

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

但是,这是缓存头:

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

为什么IIS仍然no-cache使用上述配置文件添加到此标头?

Ric*_*der 6

您需要配置IIS以将XAP视为静态内容.试试这个:

<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> 
Run Code Online (Sandbox Code Playgroud)