Error: "Detected use of SPRequest for previously closed SPWeb object" occurs when New site gallery is viewed

Respondida Error: "Detected use of SPRequest for previously closed SPWeb object" occurs when New site gallery is viewed

  • Wednesday, May 16, 2012 4:29 PM
     
     

    Hi everyone.

    I got stuck on very interesting problem. Whenever I try to create a new site and view New site gallery (Site Actions->New site) the error below occurs in the log file. I wouldn't notice this error if I wouldn't check the log file by accident because the gallery works fine and shows all item.

    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.WebControls.ScriptLink.SharePointClientJs_Register(Page page)     at Microsoft.SharePoint.WebControls.ScriptLink.InitJs_Register(Page page)     at Microsoft.SharePoint.WebControls.ScriptLink.RegisterForControl(Control ctrl, Page page, String name, Boolean localizable, Boolean defer, Boolean loadAfterUI, String language)     at Microsoft.SharePoint.WebControls.ScriptLink.Register(Page page, String name, Boolean localizable, Boolean defer, Boolean loadAfterUI, String language, String uiVersion)     at Microsoft.SharePoint.WebControls.ScriptLink.RegisterOnDemand(Page page, String strKey, String strFile, Boolean localizable)     at Microsoft.SharePoint.WebControls.ScriptLink.RegisterCore(Page page, Boolean defer)     at Microsoft.SharePoint.WebPartPages.SPWebPartManager.RegisterOWSScript(Page page, SPWeb web)     at Microsoft.SharePoint.WebPartPages.WebPartPage.FormOnLoad(Object sender, EventArgs e)     at System.Web.UI.Control.OnLoad(EventArgs e)     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 ASP._layouts_addgallery_aspx.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)

    I am not sure, but I think that error below somehow has something common with error message above. Not everytime but sometimes I get error below when I create a new site and then instead of the redirection to the newly created site the site with error message is viewed.

    File not found.

    ID correlation: eb8caaea-0900-4154-b76e-20be4dfd17c5

    I really don't know where the problem could be.

    Thanks for any help.

All Replies

  • Wednesday, May 16, 2012 4:39 PM
    Moderator
     
     

    Hi

    A similar issue  seems to be solved in this thread.


    Regards Bjoern
    Blog

  • Thursday, May 17, 2012 8:56 AM
     
     

    Thanks for your reply.

    I am really not sure if it is the same issue. I checked my wsp file and I couldn't find any incorrect lines with backslashes. Also in the post they have problem when they create a new site from template, but in my case I create just ordinary Team site. Also I don't even need to create a new site to cause the error in ULS log, to create an error in the log I can only click on the Site Actions->New site (without creating a new site)

    Any ideas? I am really lost here.

    Thanks a lot



    • Edited by David Row Thursday, May 17, 2012 8:57 AM
    • Edited by David Row Thursday, May 17, 2012 10:11 AM
    •  
  • Tuesday, May 22, 2012 7:48 AM
     
     Answered

    Hi David,

    It seems this could be caused by your custom solution fails to dispose of an SPWeb object or the solution is continuing to use SharePoint objects that were generated via an SPWeb that has been disposed.

    Please check if your custom solutions and also see this thread for some more information:
    http://social.technet.microsoft.com/Forums/lv/sharepoint2010programming/thread/d2645f2f-1a83-4e74-a5c5-88656f9ae4b3

    Thanks,
    Simon


    Simon Huang

    TechNet Community Support

    • Marked As Answer by Shimin Huang Wednesday, June 06, 2012 8:42 AM
    •  
  • Tuesday, May 22, 2012 8:38 AM
     
     

    Hi Shimin,

    Thank you, but since I found the error I tried to find out which solution cause it. So I removed all solutions one by one, but the error is still there and no solution is running on the server. This is really confusing...

    Thanks

  • Friday, May 25, 2012 6:39 AM
     
     Answered

    Hi David,

    Did you have the source code? Maybe you can try the SPDispose check tool to check your solution's source code and find the solution that cause the error.

    How did you remove the solution?Please try a IISReset when you remove the solution.

    Thanks,
    Simon


    Simon Huang

    TechNet Community Support

    • Marked As Answer by Shimin Huang Wednesday, June 06, 2012 8:42 AM
    •  
  • Friday, May 25, 2012 11:17 AM
     
     

    Hi,

    Thank you, but I tried to use SPDispose check tool and at first there was an error, but I've already solved it. It is developing machine so I use VS to debug solutions and I already restart server several times, but error still remains. Could it be some king of MS Sharepoint bug? I really can't find better explanation. Do you think some updates could solve it?

    Thanks a lot

  • Monday, May 28, 2012 2:11 AM
     
     Answered

    Hi David,

    Please try the latest cumulative update.

    http://technet.microsoft.com/en-us/sharepoint/ff800847.aspx

    Thanks,
    Simon


    Simon Huang

    TechNet Community Support

    • Marked As Answer by Shimin Huang Wednesday, June 06, 2012 8:42 AM
    •