|
We have an existing MVC2 project that we just upgraded to MVC4 following first these steps to get to MVC3, then these
steps to get to MVC4.
Output caching had been successfully working for a long time in our MVC2 project, but it does not work after the MVC4 version.
I've added a simple controller to test caching:
public class TestController : Controller
{
[OutputCache(Duration = 600, VaryByParam = "*")]
public ActionResult CacheTest()
{
return Content(DateTime.Now.ToLongTimeString());
}
}
Each time i request /Test/CacheTest in a browser, the time output to the browser changes.
Creating a new MVC3 project in this same solution, then upgrading to MVC4, then copying this same code over works as expected.
So there must be something somewhere in our existing code or configuration that is breaking output caching.
I've also tried stripping out a ton of stuff from the web.config file thinking something there was causing problems - no luck.
Rendering the CacheTest action above in any view will display cached results - i.e. the date does not change on each refresh:
<% Html.RenderAction("CacheTest", "Test"); %>
Why does that work, but the action url from a browser is never cached?
Any suggestions on how to fix or debug?
Thanks.
|