我们有一个自定义导航webpart,它使用MOSS的PortalSiteMapProvider来构建菜单导航。似乎提供商没有管理它的对象。有关如何管理在Provider中创建的对象的任何想法吗?

导致日志错误如此:

线程1上当前未发布的SPRequest对象(9)可能过多。确保正确处理此对象或其父对象(如SPWeb或SPSite)。此对象的分配ID:{56D66DBA-AE72-42DF-A70F-B45E05A60A08}当前分配的堆栈跟踪:
在Microsoft.SharePoint.SPRequestManager.Add(SPRequest请求,布尔值可共享)
at Microsoft.SharePoint.SPGlobal.CreateSPRequestAndSetIdentity(Boolean bNotGlobalAdminCode,String strUrl,Boolean bNotAddToContext,Byte [] UserToken,String userName,Boolean bIgnoreTokenTimeout,Boolean bAsAnonymous)
在Microsoft.SharePoint.SPWeb.InitializeSPRequest()
在Microsoft.SharePoint.SPWeb.EnsureSPRequest()
在Microsoft.SharePoint.SPWeb.get_Request()
在Microsoft.SharePoint.SPWeb.InitWebPublic()
在Microsoft.SharePoint.SPWeb.get_Exists()
在Microsoft.SharePoint.Publishing.CachedObjectFactory.CreateWebFromUrl(String url)
在Microsoft.SharePoint.Publishing.Navigation.SPNavigationSiteMapNode..ctor(PortalWebSiteMapNode webNode,SPNavigationNode节点,PortalSiteMapNode parentNode,NodeTypes类型,字符串url,字符串标题,字符串描述)
在Microsoft.SharePoint.Publishing.Navigation.SPNavigationSiteMapNode.CreateSPNavigationSiteMapNode(PortalWebSiteMapNode webNode,SPNavigationNode节点,PortalSiteMapNode parentNode)
在Microsoft.SharePoint.Publishing.Navigation.PortalWebSiteMapNode.ProcessSPNavigationNode(SPNavigationNode节点,SPNavigationNode previousSibling,PortalSiteMapNode parentNode)
在Microsoft.SharePoint.Publishing.Navigation.PortalWebSiteMap.Node.PopulateNavigationChildren()
在Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapNode.GetNavigationChildren(NodeTypes includedTypes,NodeTypes includedHiddenTypes,OrderingMethod ordering,AutomaticSortingMethod method,Boolean ascending,Int32 lcid)
在Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapNode.GetNavigationChildren(NodeTypes includedHiddenTypes)
在Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapProvider.GetChildNodes(PortalSiteMapNode节点,NodeTypes includedHiddenTypes)
在Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapProvider.GetChildNodes(SiteMapNode节点)
在System.Web.SiteMapNode.get_ChildNodes()
在Microsoft.SharePoint.Publishing.Navigation.PortalHierarchicalEnumerable.System.Collections.IEnumerable.GetEnumerator()
在System.Web.UI.WebControls.Menu.DataBindRecursive(MenuItem节点,IHierarchicalEnumerable可枚举)
在System.Web.UI.WebControls.Menu.DataBindRecursive(MenuItem节点,IHierarchicalEnumerable可枚举)
在System.Web.UI.WebControls.Menu.DataBindItem(MenuItem item)中 在System.Web.UI.WebControls.Menu.PerformDataBinding()
在System.Web.UI.WebControls.HierarchicalDataBoundControl.PerformSelect()
在System.Web.UI.WebControls.BaseDataBoundControl.DataBind()
在System.Web.UI.WebControls.Menu.DataBind()
在System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound()
在System.Web.UI.WebControls.Menu.EnsureDataBound()
在System.Web.UI.WebControls.BaseDataBoundControl.OnPreRender(EventArgs e)
在System.Web.UI.WebControls.Menu.OnPreRender(EventArgs e,Boolean registerScript)
在System.Web.UI.WebControls.Menu.OnPreRender(EventArgs e)
在Microsoft.SharePoint.WebControls.AspMenu.OnPreRender(EventArgs e)
在System.Web.UI.Control.PreRenderRecursiveInternal()
在System.Web.UI.Control.PreRenderRecursiveInternal()
在System.Web.UI.Control.PreRenderRecursiveInternal()
在System.Web.UI.Control.PreRenderRecursiveInternal()<

有帮助吗?

解决方案

StefanGoßner的博文似乎回答了这个问题。问题不是SPWeb对象没有被关闭,而是一旦达到某个阈值(默认为8)的分配,就会在日志中创建警告。根据您的网站结构,将创建的数量会有所不同。鉴于导航的嵌套特性,在遍历子树时,对象保持打开状态。因此 对象被正确处理掉,只是在给定时间内保持打开超过8个(默认情况下)。

看到这个问题

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top