我在SharePoint ULS日志中发现了许多8L1N警告。有趣的是,整个堆栈跟踪没有在我的代码中显示任何内容。我不确定在这种情况下要寻找什么?可能是导致这一导致的某些配置错误吗?

我如何避免此警告?

下面的ULS日志:

An SPRequest object was not disposed before the end of this thread.  To avoid wasting system resources, dispose of this object or its parent (such as an SPSite or SPWeb) as soon as you are done using it.  This object will now be disposed.  Allocation Id: {DBFA1F95-40DF-4AB6-BE88-3AE39F7E4E1F}  This SPRequest was allocated at    at Microsoft.SharePoint.Library.SPRequest..ctor()     at Microsoft.SharePoint.SPGlobal.CreateSPRequestAndSetIdentity(Boolean bNotGlobalAdminCode, String strUrl, Boolean bNotAddToContext, Byte[] UserToken, String userName, Boolean bIgnoreTokenTimeout, Boolean bAsAnonymous)     at Microsoft.SharePoint.SPWeb.InitializeSPRequest()     at Microsoft.SharePoint.SPWeb.EnsureSPRequest()     at Microsoft.SharePoint.SPWeb.get_Request()     at Microsoft.SharePoint.SPWeb.get_All...  
06/03/2009 10:21:05.10* w3wp.exe (0x170C)                       	0x10F8	Windows SharePoint Services   	General                       	8l1n	High    	...Properties()     at Microsoft.SharePoint.ApplicationPages.PermissionSetupPage.GetParentWebAssociatedGroups()     at Microsoft.SharePoint.ApplicationPages.PermissionSetupPage.OnLoad(EventArgs e)     at System.Web.UI.Control.LoadRecursive()     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.ProcessRequestWithNoAssert(HttpContext context)     at System.Web.UI.Page.ProcessRequest(HttpContext context)     at ASP._layouts_permsetup_aspx.ProcessRequest(HttpContext context)     at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.H...
06/03/2009 10:21:05.10* w3wp.exe (0x170C)                       	0x10F8	Windows SharePoint Services   	General                       	8l1n	High    	...ttpApplication.IExecutionStep.Execute()     at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)     at System.Web.HttpApplication.ApplicationStepManager.ResumeSteps(Exception error)     at System.Web.HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)     at System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)     at System.Web.HttpRuntime.ProcessRequestNoDemand(HttpWorkerRequest wr)     at System.Web.Hosting.ISAPIRuntime.ProcessRequest(IntPtr ecb, Int32 iWRType)
有帮助吗?

解决方案

是的,有时微软不遵循自己的最佳实践。我在这里提到了: 使用Spsite OpenWeb创建的SPWEB

您真的无能为力。

其他提示

您应该查看您的代码,并正确处理您自己创建的Spsite,Spweb(和其他)(如“ new Spobject(url)”和sites.openweb())。这些对象包含不受管理的sprequest对象,这些对象不会自动处置。

为了使您在此过程中您应该使用 spdisposecheck (我通常将spdisposecheck设置为在构建代码时自动运行)。

有个 白皮书 在MSDN上可以为您提供帮助。请注意,并非所有的spsite和spweb对象都应被处置。 Spsite和Spweb从Spcontext。通常不应处理。有关何时的进一步指导 不是 要处置,请参见Roger Lambs “不要处置指导”。

注意:上面的警告不应与“潜在的sprequest对象数量过多”混淆。此警告并不一定表明您的对象没有被处置,只是您打开了其中的很多(例如,通过当前网进行循环时)。可以通过将TRESHOLD设置为更大的值来减轻此警告:

HKEY_LOCAL_MACHINE SOFTWORD MICROSOFT 共享工具 Web Server Extensions HeapSettings

    LocalSPRequestWarnCount = 50

进一步阅读:

最佳实践:使用一次性Windows SharePoint服务对象

使用SpdisPosecheck自动sharePoint Dispose()代码评论

SharePoint 2007/2010“请勿处置指导” + spdisposecheck

WSS V3和MOSS 2007中的SPSITE/SPWEB泄漏故障排除

SharePoint 2007和WSS 3.0以身作用处置模式

Hth Anders Rask

许可以下: CC-BY-SA归因
scroll top