2012-08-02 123 views
1

部署有Telerik的擴展菜單的MVC3應用程序後,我注意到有它拋出一個OutOfMemoryException和之後的時間,應用程序凍結,沒有用戶大約一個小時後能夠使用的應用程序,直到或者所以。MVC3內存溢出異常

我設法跟蹤從Windows事件日誌中的錯誤,下面是從事件中提取的錯誤之一的堆棧跟蹤日誌

異常信息:

Exception type: OutOfMemoryException 
Exception message: Exception of type 'System.OutOfMemoryException' was thrown. 
at System.RuntimeTypeHandle.ConstructName(RuntimeTypeHandle handle, 
Boolean nameSpace, Boolean fullInst, Boolean assembly, StringHandleOnStack retString) 
at System.RuntimeType.RuntimeTypeCache.ConstructName(String& name, Boolean nameSpace, Boolean fullinst, Boolean assembly) 
at System.RuntimeType.get_Name() 
at Telerik.Web.Mvc.Infrastructure.Implementation.ControllerTypeCache.<GetAllControllerTypes>b__d(Type type) 
at System.Linq.Enumerable.WhereArrayIterator`1.MoveNext() 
at Telerik.Web.Mvc.Extensions.CollectionExtensions.AddRange[T](ICollection`1 instance, IEnumerable`1 collection) 
at Telerik.Web.Mvc.Infrastructure.Implementation.ControllerTypeCache.GetAllControllerTypes() 
at Telerik.Web.Mvc.Infrastructure.Implementation.ControllerTypeCache.<GetControllerTypesWithinNamespaces>b__4() 
at Telerik.Web.Mvc.Infrastructure.Implementation.Cache.Get[T](String key, Func`1 defaultValueFactory) 
at Telerik.Web.Mvc.Infrastructure.Implementation.ControllerTypeCache.GetControllerTypesWithinNamespaces(String controllerName, IEnumerable`1 namespaces) 
at Telerik.Web.Mvc.Infrastructure.Implementation.ControllerTypeCache.GetControllerTypes(String controllerName) 
at Telerik.Web.Mvc.Infrastructure.Implementation.ControllerDescriptorCache.ControllerDescriptorFactory(String controllerName, String areaName) 
at Telerik.Web.Mvc.Infrastructure.Implementation.ControllerDescriptorCache.<>c__DisplayClass1.<GetControllerDescriptor>b__0() 
at Telerik.Web.Mvc.Infrastructure.Implementation.Cache.Get[T](String key, Func`1 defaultValueFactory) 
at Telerik.Web.Mvc.Infrastructure.Implementation.ControllerDescriptorCache.GetControllerDescriptor(String controllerName, String areaName) 
at Telerik.Web.Mvc.Infrastructure.Implementation.AuthorizationContextCache.AuthorizationContextFactory(RequestContext requestContext, String controllerName, String actionName, String areaName) 
at Telerik.Web.Mvc.Infrastructure.Implementation.AuthorizationContextCache.<>c__DisplayClass1.<GetAuthorizationContext>b__0() 
at Telerik.Web.Mvc.Infrastructure.Implementation.Cache.Get[T](String key, Func`1 defaultValueFactory) 
at Telerik.Web.Mvc.Infrastructure.Implementation.AuthorizationContextCache.GetAuthorizationContext(RequestContext requestContext, String controllerName, String actionName, RouteValueDictionary routeValues) 
at Telerik.Web.Mvc.Infrastructure.Implementation.ControllerAuthorization.IsAccessibleToUser(RequestContext requestContext, String controllerName, String actionName, RouteValueDictionary routeValues) 
at Telerik.Web.Mvc.Infrastructure.Implementation.NavigationItemAuthorization.IsAccessibleToUser(RequestContext requestContext, INavigatable navigationItem) 
at Telerik.Web.Mvc.UI.NavigatableExtensions.<>c__DisplayClass2`1.<IsAccessible>b__1(T item) 
at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate) 
at Telerik.Web.Mvc.UI.NavigatableExtensions.IsAccessible[T](IEnumerable`1 items, INavigationItemAuthorization authorization, ViewContext viewContext) 
at Telerik.Web.Mvc.UI.NavigationItemContainerExtensions.WriteItem[TComponent,TItem](TItem item, TComponent component, IHtmlNode parentTag, INavigationComponentHtmlBuilder`1 builder) 
at Telerik.Web.Mvc.UI.Menu.<>c__DisplayClass4.<WriteHtml>b__3(MenuItem item) 
at Telerik.Web.Mvc.Extensions.EnumerableExtensions.Each[T](IEnumerable`1 instance, Action`1 action) 
at Telerik.Web.Mvc.UI.Menu.WriteHtml(HtmlTextWriter writer) 
at Telerik.Web.Mvc.UI.ViewComponentBase.Render() 
at Telerik.Web.Mvc.UI.ViewComponentBuilderBase`2.Render() 
at ASP._Page_Views_Shared__Layout_cshtml.Execute() in e:\kidda\Views\Shared\_Layout.cshtml:line 34 
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy() 
at System.Web.Mvc.WebViewPage.ExecutePageHierarchy() 
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) 
at System.Web.WebPages.WebPageBase.<>c__DisplayClass7.<RenderPageCore>b__6(TextWriter writer) 
at System.Web.WebPages.HelperResult.WriteTo(TextWriter writer) 
at System.Web.WebPages.WebPageBase.Write(HelperResult result) 
at System.Web.WebPages.WebPageBase.RenderSurrounding(String partialViewName, Action`1 body) 
at System.Web.WebPages.WebPageBase.PopContext() 
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) 
at System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) 
at System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) 
at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) 
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) 
at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) 
at System.Web.Mvc.Controller.ExecuteCore() 
at System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) 
at System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) 
at System.Web.Mvc.MvcHandler.<>c__DisplayClass6.<>c__DisplayClassb.<BeginProcessRequest>b__5() 
at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass1.<MakeVoidDelegate>b__0() 
at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) 
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.End() 
at System.Web.Mvc.MvcHandler.<>c__DisplayClasse.<EndProcessRequest>b__d() 
at System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) 
at System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) 
at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) 
at System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) 
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() 
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) 

常見於堆棧跟蹤到的所有錯誤堆棧跟蹤是在_Layout.cshtml線34用下面的代碼

<nav> 
    <div id="topMenu" > 
     <div style="width: 45%; float: right"> 
      @{ Html.Telerik().Menu() 
       .Name("Menu") 
       .Items(menu => 
        { 
         menu.Add() 
         .Text("Ngaari") 
         .Items(item => 
         { 
          item.Add().Text("List").Action("Index", "Ngaari"); 
          item.Add().Text("Statement").Action("Index", "Statement"); 
         }); 
         menu.Add() 
         .Text("Njia") 
         .Action("Index", "Njia"); 
         menu.Add() 
         .Text("Kiama") 
         .Action("Index", "Kiama"); 
         menu.Add() 
         .Text("Ngaari Type") 
         .Action("Index", "NgaariType"); 
         menu.Add() 
         .Text("Admin") 
         .Items(item => 
         { 
          item.Add().Text("List Users").Action("Index", "Account"); 
          item.Add().Text("Add User").Action("NewUser", "Account"); 
          item.Add().Text("Change Password").Action("ChangePassword", "Account"); 
         }); 
       }) 
       .Render(); 
       } 
     </div> 
    </div> 
</nav> 

該應用程序在Windows運行的繪製菜單2003 SP2,內存爲4Gb,用戶使用Mozilla Firefox訪問系統。

我用Google搜索,並在Telerik的論壇和SOF並沒有發現答案或相似的用戶誰可能有類似的問題。

什麼可能會造成這個錯誤,我該怎麼去解決呢?

回答

1

服務器上監控性能和內存使用解決了這個問題。 我意識到IIS與SQL Server的爭用內存和存儲是不是 頻繁回收,這是什麼導致問題

在從IIS 6 Administration的建議,我執行以下操作:

  • 設置應用程序池請求預設數量後回收
  • 集倍在低活動時間回收工作進程
  • 設定爲由用在虛擬和物理存儲器的量的帽3210應用

執行上述已完全消除該問題。