Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/fsharp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sharepoint 2010 如何处置这些物品?_Sharepoint 2010 - Fatal编程技术网

Sharepoint 2010 如何处置这些物品?

Sharepoint 2010 如何处置这些物品?,sharepoint-2010,Sharepoint 2010,我维护的项目有一组usercontrols,其中SPWeb和SPSite对象在SPContext的构造函数中初始化。然后将这些对象传递给其他类 public MyUserControl : UserControl { private SPWeb web; public MyUserControl() { web = SPContext.Current.Web; } AnotherClass.SomeMethod ( web ); } 日志中包含以下两个条目: (一) (二) 在此线程结束之

我维护的项目有一组usercontrols,其中SPWeb和SPSite对象在SPContext的构造函数中初始化。然后将这些对象传递给其他类

public MyUserControl : UserControl
{  
private SPWeb web;
public MyUserControl() { web = SPContext.Current.Web; }
AnotherClass.SomeMethod ( web );
}
日志中包含以下两个条目:

(一)

(二)

在此线程结束之前未释放SPRequest对象。为避免浪费系统资源,请在使用完此对象或其父对象(如SPSite或SPWeb)后立即将其丢弃。现在将处理此对象。分配Id:{444DCA1-C2F6-493D-9D02-D04F75C6E384}已分配此SPRequest
在
在Microsoft.SharePoint.Library.SPRequest..ctor()上
位于Microsoft.SharePoint.SPGlobal.createsRequestAndSetIdentity(SPSite站点、字符串名称、布尔bNotGlobalAdminCode、字符串strUrl、布尔bNotAddToContext、字节[]UserToken、字符串用户名、布尔BigNoreTokentTimeout、布尔bAsAnonymous)
在Microsoft.SharePoint.SPWeb.InitializeSPRequest()上
在Microsoft.SharePoint.SPWeb.InitWebPublic()上
在Microsoft.SharePoint.SPWeb.get_LanguageCulture()上
在Microsoft.SharePoint.SPWeb.get_Title()上
在XXXXXXXXX.DataAccessUtility.c__DisplayClassc.b__8()
在Microsoft.SharePoint.SPSecurity.c__DisplayClass4.b__2()上
位于Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToUnelevated secureCode)
在Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback secureCode,对象参数)
在Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(Code或Unelevated secureCode)上运行
在XXXXXXXX.GetSitesTopNav(SPSite站点、SPWeb Currentweb、字符串用户名)
在XXXXXXXX.Web.UserControls.TopNavigation.PopulateSiteSelection()上
位于XXXXXXXX.Web.UserControls.TopNavigation.OnLoad(EventArgs e)
在System.Web.UI.Control.LoadRecursive()中
在System.Web.UI.Control.LoadRecursive()中
在System.Web.UI.Control.LoadRecursive()中
在System.Web.UI.Control.LoadRecursive()中
在System.Web.UI.Control.LoadRecursive()中
在System.Web.UI.Page.ProcessRequestMain(布尔includeStagesBeforeAsyncPoint,布尔includeStagesAfterAsyncPoint)
在System.Web.UI.Page.ProcessRequest(布尔includeStagesBeforeAsyncPoint,布尔includeStagesAfterAsyncPoint)
在System.Web.UI.Page.ProcessRequest()中
在System.Web.UI.Page.ProcessRequest(HttpContext上下文)中
在System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()中
在System.Web.HttpApplication.ExecuteStep(IExecutionStep步骤,布尔值&同步完成)
位于System.Web.HttpApplication.PipelineStepManager.ResumeSteps(异常错误)
位于System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext上下文,AsyncCallback cb)
位于System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr,HttpContext上下文)
位于System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr managedHttpContext、IntPtr nativeRequestContext、IntPtr moduleData、Int32标志)
位于System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr managedHttpContext、IntPtr nativeRequestContext、IntPtr moduleData、Int32标志)
位于System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr managedHttpContext、IntPtr nativeRequestContext、IntPtr moduleData、Int32标志)
位于System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr managedHttpContext、IntPtr nativeRequestContext、IntPtr moduleData、Int32标志)
传递从SPContext.Current.Web.url获得的url是否正确?有什么建议吗

Detected use of SPRequest for previously closed SPWeb object.  Please close SPWeb objects when you are done with all objects obtained from them, but not before.  Stack trace:   
 at Microsoft.SharePoint.SPListItemCollection.EnsureListItemsData()    
 at Microsoft.SharePoint.SPListItemCollection.GetEnumerator()    
 at XXXXXXXX.Web.UserControls.TopNavigation.LoadTopImage()    
 at XXXXXXXX.Web.UserControls.TopNavigation.OnLoad(EventArgs e)    
 at System.Web.UI.Control.LoadRecursive()    
 at System.Web.UI.Control.LoadRecursive()    
 at System.Web.UI.Control.LoadRecursive()    
 at System.Web.UI.Control.LoadRecursive()    
 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.ProcessRequest(HttpContext context)    
 at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()    
 at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)    
 at System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error)    
 at System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb)    
 at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)    
 at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)    
 at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)    
 at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)    
 at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
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: {444DCCA1-C2F6-493D-9D02-D04F75C6E384}  This SPRequest was allocated
 at   
 at Microsoft.SharePoint.Library.SPRequest..ctor()    
 at Microsoft.SharePoint.SPGlobal.CreateSPRequestAndSetIdentity(SPSite site, String name, Boolean bNotGlobalAdminCode, String strUrl, Boolean bNotAddToContext, Byte[] UserToken, String userName, Boolean bIgnoreTokenTimeout, Boolean bAsAnonymous)    
 at Microsoft.SharePoint.SPWeb.InitializeSPRequest()    
 at Microsoft.SharePoint.SPWeb.InitWebPublic()    
 at Microsoft.SharePoint.SPWeb.get_LanguageCulture()    
 at Microsoft.SharePoint.SPWeb.get_Title()    
 at XXXXXXXXX.DataAccessUtility.<>c__DisplayClassc.<GetSitesTopNav>b__8()    
 at Microsoft.SharePoint.SPSecurity.<>c__DisplayClass4.<RunWithElevatedPrivileges>b__2()    
 at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode)    
 at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback secureCode, Object param)    
 at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated secureCode)    
 at XXXXXXXX.GetSitesTopNav(SPSite site, SPWeb Currentweb, String userName)    
 at XXXXXXXX.Web.UserControls.TopNavigation.PopulateSiteSelection()    
 at XXXXXXXX.Web.UserControls.TopNavigation.OnLoad(EventArgs e)    
 at System.Web.UI.Control.LoadRecursive()    
 at System.Web.UI.Control.LoadRecursive()    
 at System.Web.UI.Control.LoadRecursive()    
 at System.Web.UI.Control.LoadRecursive()    
 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.ProcessRequest(HttpContext context)    
 at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()    
 at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)    
 at System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error)    
 at System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb)    
 at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)    
 at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)    
 at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)    
 at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)    
 at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)