Asp.net mvc OutputCache位置=OutputCacheLocation。客户端不工作
我试图使用Asp.net mvc OutputCache位置=OutputCacheLocation。客户端不工作,asp.net-mvc,outputcache,Asp.net Mvc,Outputcache,我试图使用OutputCache缓存图像(从数据库返回)。不幸的是,这似乎不起作用。如果我设置了Location=OutputCacheLocation.ServerAndClient,它会在服务器上正确缓存它,但不会在浏览器上?有什么关于原因的建议吗 [OutputCache(Duration = 3600, VaryByParam = "serialNumber;activityId", Location = OutputCacheLoca
OutputCache
缓存图像(从数据库返回)。不幸的是,这似乎不起作用。如果我设置了Location=OutputCacheLocation.ServerAndClient
,它会在服务器上正确缓存它,但不会在浏览器上?有什么关于原因的建议吗
[OutputCache(Duration = 3600,
VaryByParam = "serialNumber;activityId",
Location = OutputCacheLocation.Client,
NoStore = true)]
public ActionResult GetImage(string serialNumber, int activityId)
{
var byteArray = this.service.GetImage(serialNumber, activityId);
return File(byteArray, "image/jpeg"); // adjust content type appropriately
}
为什么将NoStore设置为true?我认为,如果您删除:
NoStore = true
你找到原因了吗?我也有同样的问题。