Domanda

Ho trovato molti avvertimenti 8l1n di oggetti undisposed nei registri di SharePoint ULS. La cosa interessante è che l'intero stack trace non mostra nulla nel mio codice. Non sono sicuro di cosa cercare in quel caso? Può essere qualche errore di configurazione che ha portato a questo?

Come posso evitare questo avvertimento?

registro ULS di seguito:

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)
È stato utile?

Soluzione

Sì, a volte Microsoft non segue è di possedere le migliori pratiche. Ne ho parlato qui: di spwebs creata usando SPSite OpenWeb

Non c'è davvero niente che si può fare al riguardo.

Altri suggerimenti

Si dovrebbe rivedere il codice e smaltire lo SPSite, SPWeb (e altri) creato da voi (come in "nuova SPObject (URL)" e sites.OpenWeb ()). Questi oggetti contengono oggetti SPRequest non gestiti che non saranno automaticamente disposti.

A voi assis in questo processo si dovrebbe utilizzare SPDisposeCheck (io di solito impostato SPDisposeCheck per l'esecuzione automatica quando costruisco il mio codice).

C'è un whitepaper su MSDN che può aiutarvi futher. Essere consapevoli del fatto che non tutti gli oggetti SPSite e SPWeb devono essere smaltiti. Lo SPSite e di SPWeb di presa da SPContext.Current non dovrebbero essere eliminate. Per ulteriori indicazioni su quando non di disporre, vedere Roger Agnelli "do guida non smaltire".

Nota: l'avviso di cui sopra non deve essere confuso con il "numero eccessivo di oggetti Potentiallt SPRequest .." avvertimento nel registro ULS. Questo avviso non indica necessariamente gli oggetti non vengono smaltiti, solo che avete aperto un sacco di loro (come quando si fa un ciclo attraverso reti attuali). Questo avviso può essere mitigato attraverso la creazione della soglia ad un valore più grande:

HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Shared Tools \ Web Server Extensions \ HeapSettings

    LocalSPRequestWarnCount = 50

Per ulteriori approfondimenti:

Best Practices: Usando monouso di Windows SharePoint Services Oggetti

Automatizzare SharePoint Dispose () revisioni del codice con SPDisposeCheck

SharePoint 2007/2010‘Non gettare Guidance’+ SPDisposeCheck

Risoluzione dei problemi SPSite / perdite SPWeb in WSS v3 e MOSS 2007

SharePoint 2007 e WSS 3.0 Patterns disporre in Esempio

hth Anders Rask

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a sharepoint.stackexchange
scroll top