代码之家  ›  专栏  ›  技术社区  ›  webwires

PortalItemApprovider导致SPRequest对象过多

  •  1
  • webwires  · 技术社区  · 16 年前

    我们有一个自定义导航Web部件,它使用MOSS的PortalItemApprovider构建菜单导航。提供者似乎没有管理它的对象。您知道如何管理在提供程序中创建的对象吗?

    它会导致如下日志错误:

    线程1上当前未释放的SPRequest对象(9)数量可能过多。确保此对象或其父对象(如SPWeb或SPSite)已正确处置。此对象的分配Id:{56D66DBA-AE72-42DF-A70F-B45E05A60A08}当前分配的堆栈跟踪:


    在Microsoft.SharePoint.SPWeb.InitializeSPRequest()上

    在Microsoft.SharePoint.SPWeb.get_请求()上
    在Microsoft.SharePoint.SPWeb.InitWebPublic()上
    位于Microsoft.SharePoint.SPWeb.get_Exists()上

    位于Microsoft.SharePoint.Publishing.Navigation.SpNavigationItemsNode..ctor(PortalWebSiteMapNode webNode、SPNavigationNode、PortalItemsNode parentNode、NodeType、String url、String标题、String描述)
    在Microsoft.SharePoint.Publishing.Navigation.SpNavigationsItemsNode.CreateSpNavigationsItemsNode(PortalWebSiteMapNode webNode、SPNavigationNode、PortalItemsNode parentNode)
    位于Microsoft.SharePoint.Publishing.Navigation.PortalWebSiteMapNode.ProcessSPNavigationNode(SPNavigationNode节点、SPNavigationNode先前的同级节点、PortalSiteMapNode父节点)

    在Microsoft.SharePoint.Publishing.Navigation.PortalItemsNode.GetNavigationChildren(节点类型包括类型,节点类型包括隐藏类型,排序方法排序,自动排序方法,布尔升序,Int32 lcid)
    位于Microsoft.SharePoint.Publishing.Navigation.PortalItemsNode.GetNavigationChildren(节点类型包括HiddenTypes)
    位于Microsoft.SharePoint.Publishing.Navigation.PortalItemApprovider.GetChildNodes(PortalItemsNode节点,节点类型包括HiddenTypes)
    位于Microsoft.SharePoint.Publishing.Navigation.PortalItemApprovider.GetChildNodes(SiteMapNode节点)
    在System.Web.SiteMapNode.get_ChildNodes()上
    在Microsoft.SharePoint.Publishing.Navigation.PortalHierarchicalEnumerable.System.Collections.IEnumerable.GetEnumerator()中

    位于System.Web.UI.WebControl.Menu.DataBindRecursive(MenuItem节点,IHierarchicalEnumerable枚举)
    在System.Web.UI.WebControl.Menu.DataBindem(菜单项)中

    在System.Web.UI.WebControl.HierarchycalDataboundControl.PerformSelect()中
    在System.Web.UI.WebControls.BaseDataBoundControl.DataBind()中

    在System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound()中
    在System.Web.UI.WebControls.Menu.EnsureDataBound()中

    在System.Web.UI.WebControl.Menu.OnPreRender(EventArgs e,布尔寄存器脚本)中
    在System.Web.UI.WebControls.Menu.OnPreRender(EventArgs e)中

    在System.Web.UI.Control.PreRenderCursiveInternal()中
    在System.Web.UI.Control.PreRenderCursiveInternal()中
    在System.Web.UI.Control.PreRenderCursiveInternal()中

    在System.Web.UI.Control.PreRenderCursiveInternal()中
    在System.Web.UI.Control.PreRenderCursiveInternal()中
    在System.Web.UI.Control.PreRenderCursiveInternal()中
    在System.Web.UI.Page.ProcessRequestMain(布尔includeStagesBeforeAsyncPoint,布尔includeStagesAfterAsyncPoint)
    在System.Web.UI.Page.ProcessRequest(布尔includeStagesBeforeAsyncPoint,布尔includeStagesAfterAsyncPoint)
    位于System.Web.UI.Page.ProcessRequest()的System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext上下文)

    在System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()中

    位于System.Web.HttpApplication.ApplicationStepManager.ResumeSteps(异常错误)
    位于System.Web.HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpCont

    1 回复  |  直到 16 年前
        1
  •  4
  •   Community leo1    7 年前

    Stefan Goßner 的博客文章似乎回答了这个问题。问题不是SPWeb对象没有关闭,而是一旦达到某个分配阈值(默认值为8),就会在日志中创建警告。根据您的站点结构,将创建的数量将有所不同。鉴于导航的嵌套性质,对象在遍历子树时保持打开状态。那么物体呢

    See this question