asp.net缓存与可用资源有关?

时间:2012-12-28 09:38:36

标签: c# caching datatable

我使用以下方法将相当大的数据表缓存到应用程序缓存中:

HttpContext.Current.Cache.Insert(GlobalVars.Current.applicationID + "_" + cacheName, itemToCache, null, System.Web.Caching.Cache.NoAbsoluteExpiration, TimeSpan.FromMinutes(240));

正如您所看到的,它应该在缓存中保留4个小时,但是我们看到了奇怪的结果:

在CPU和CPU低的网站上低RAM使用率(比如0-150个用户)我们没有收到任何错误。

在CPU占用率高且占用率低(CPU约为90%,用户数为300 - 600)的网站上,我们每20-60分钟收到以下错误:

    Cannot find column EditorOrder.

System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.IndexOutOfRangeException: Cannot find column EditorOrder.
   at System.Data.DataTable.ParseSortString(String sortString)
   at System.Data.DataView.set_Sort(String value)
   at delima_v1._01.templates.results.editors_picks.Page_Load(Object sender, EventArgs e)
   at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.HandleError(Exception e)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest()
   at System.Web.UI.Page.ProcessRequest(HttpContext context)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

EditorOrder是一个从SQL获取结果后手动添加到数据表的列。所以我不确定该列是否以某种方式被删除或整个缓存丢失,错误似乎表明它是列丢失。正如我所说,它似乎只是在高负载下,不确定IIS / Windows是否有任何影响......

网站在64位AppPool中运行ASP.NET 4.0

非常感谢,

戴夫

0 个答案:

没有答案