在MVC4中管理图像和媒体文件



我已经在MVC4中使用了bundling来管理cssjs文件,但是我没有找到用于管理/缓存图像和MVC4中的媒体文件的好解决方案。

我应该为此运行另一台静态文件服务器吗?

您可以通过web.config和staticContent/clientCache元素为静态内容配置IIS CACHE标头。

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

用于一个小时的缓存策略。

相关内容

最新更新