[英]Caching in ASP.NET 5 in Controller
我試圖像在ASP.NET MVC 5中那樣緩存輸出控制器。
我在ASP.NET MVC 5 Controller中做到了這一點:
[OutputCache(Duration = 60, VaryByParam = "*", Location = OutputCacheLocation.ServerAndClient)]
現在,我在ASP.NET 5 MVC 6中嘗試這樣做:
控制器屬性:
[ResponseCache(CacheProfileName = "TestCache")]
在我的Startup.cs中 :
//Caching
services.Configure<MvcOptions>(options => options.CacheProfiles.Add("TestCache", new CacheProfile()
{
Duration = 3600,
Location = ResponseCacheLocation.Any,
VaryByHeader = "*"
}));
我在TestController中添加了一個斷點,但每次都會觸發breakboint。
我該如何解決?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.