【发布时间】:2014-01-16 12:59:46
【问题描述】:
我想在 web.config 中设置 expires 和 cachecontrol 和 httpExpires 标头
按照该问题的答案
What's the difference Expires and Cache-control:max-age?
<system.webServer>
<staticContent>
<clientCache cacheControlCustom="public" cacheControlMaxAge="12:00:00" cacheControlMode="UseMaxAge" />
<clientCache cacheControlCustom="public" httpExpires="Tue, 19 Jan 2038 03:14:07 GMT" cacheControlMode="UseExpires" />
</staticContent>
</system.webServer>
但由于某种原因,当我这样做时,图像变得不可用。
每次图像加载时我都有Failed to load resource: the server responded with a status of 500 (Internal Server Error) 错误(我可以在browser dev tools console 中看到错误)。
我猜我配置错了?
如果我只留下一个评论 clientCache 部分的任何部分,它会起作用
如何解决?
更新: 刚刚又问了一个相关问题how to set up both httpexpires and cachecontrol headers web.cofig:
【问题讨论】:
-
我已经编辑了你的标题。请参阅“Should questions include “tags” in their titles?”,其中的共识是“不,他们不应该”。
-
我在使用
UseExpires和UseMaxAge时遇到了同样的问题,您找到任何解决方案了吗,或者我们可以同时使用吗?
标签: asp.net asp.net-mvc http-headers cache-control