I have the following Action method:-
[HttpGet]
[OutputCache(CacheProfile = "long", Location = OutputCacheLocation.Server, VaryByHeader = "X-Requested-With")]
public PartialViewResult LatestAssets()
{
var tech = repository.LatestTechnology().OrderByDescending(a => a.TechnologyID).Take(5).ToList() ;
return PartialView("_Latest",tech);
}
which is calling inside the _layout view through the following code:-
<li class="nav-header hidden-tablet"style="background-color:#3E9BD4 ; color:white">Latest Assets</li>
@Html.Action("LatestAssets","Home")
The Cache Profile is define inside the web.config as follow:-
<system.web>
<caching>
<outputCacheSettings>
<outputCacheProfiles>
<add name="long" duration="300" />
<add name="Short" duration="100" />
</outputCacheProfiles>
</outputCacheSettings>
</caching>
but i am getting the following code when the action method is called:-
Duration must be a positive number. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: Duration must be a positive number
And if i remove the CacheProfile the above will work fine. any idea what is causing this error.