IIS捆绑/更少缓存问题

时间:2015-07-03 08:32:08

标签: asp.net asp.net-mvc caching iis cache-control

我有一个ASP.NET MVC 5项目,它使用dotless来解析/编译.less文件,使用标准的bundler来缩小/捆绑js文件。

问题是,在生产服务器上,当IIS上的本地表示设置为max-age=0, no-cache, no-store并在一年后到期时,cache-conrole标头设置为public

无点配置:<dotless minifyCss="true" cache="true" web="true" handleWebCompression="false" />

捆绑配置 - 只包括和BundleTable.EnableOptimizations = true;

很少有可能有用的网络配置部分:

<staticContent>
  <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="7.00:00:00" />
</staticContent>
...
<modules runAllManagedModulesForAllRequests="true">
  <add name="Prerender" type="Prerender.io.PrerenderModule, Prerender.io, Version=1.0.0.2, Culture=neutral, PublicKeyToken=null"/>
  <add name="Spring" type="Spring.Context.Support.WebSupportModule, Spring.Web" />
  <add name="OpenSessionInView" type="Spring.Data.NHibernate.Support.OpenSessionInViewModule, Spring.Data.NHibernate32" />
</modules>
...
<handlers>
  <remove name="OPTIONSVerbHandler" />
  <remove name="TRACEVerbHandler" />
  <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
  <add name="dotless" path="*.less" verb="GET" type="dotless.Core.LessCssHttpHandler,dotless.Core" resourceType="File" preCondition="" />
</handlers>

我尝试将mime地图添加到staticContent部分。还考虑在iis中添加请求标头,但它仅适用于文件/文件夹,因此它可能不会提供捆绑包。

我在配置中错过了什么?我很欣赏解决这个问题的任何想法。

1 个答案:

答案 0 :(得分:1)

检查你的web.config中是否有这个东西:

<configuration>
    <system.web>
        <compilation debug="false"/>
相关问题