【问题标题】:How to enable folder level cache on IIS 7.5?如何在 IIS 7.5 上启用文件夹级缓存?
【发布时间】:2018-09-07 10:39:46
【问题描述】:

我在 IIS7.5 上有一个虚拟目录,它有 .mp4 文件。

我想在文件夹级别启用缓存,这样视频就可以在没有缓冲的情况下播放。可以使用以下“web.config”吗?我想将“Web.config”放在文件夹中。

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <staticContent>
      <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="01:00:00" />
    </staticContent>
  </system.webServer>
</configuration>

我也想将缓存限制为 1GB,我该如何实现?

【问题讨论】:

    标签: caching iis-7.5 static-content


    【解决方案1】:
    <configuration>
      <system.web>
        <httpRuntime maxRequestLength="1048576" />
      </system.web>
    </configuration>
    

    1048576 = 1024 MB 你可以阅读这篇文章:windows server 2008 IIS 7.5 maximum file accept limit

    <configuration>
        <system.webServer>
            <staticContent>
                <mimeMap fileExtension=".mp4" mimeType="video/mp4" />
                <mimeMap fileExtension=".m4v" mimeType="video/m4v" />
         </staticContent>
        </system.webServer>
    </configuration> 
    

    阅读这篇文章,也许它可以帮助你。 https://blogs.iis.net/bills/how-to-add-mime-types-with-iis7-web-config

    【讨论】:

    • 我只想缓存 .mp4 文件,我该如何应用?
    • 好的,感谢您的建议,我修改了答案并添加了部分代码,并放置了链接,以便您在那里寻找解释。
    【解决方案2】:

    这可能对你有帮助:

    <configuration> 
     <location path="showStockPrice.asp">     
       <system.webserver>        
         <caching>         
           <profiles>
             <add varybyquerystring="*"location="Any"
               duration="00:00:01" policy="CacheForTimePeriod"            
               extension=".asp">
           </profiles>
         </caching>
       </system.webserver>
     </location> 
    </configuration>
    

    更多详情herehere

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-11-14
      • 1970-01-01
      • 2011-10-01
      • 2012-04-23
      • 2016-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-10-13
      相关资源
      最近更新 更多