Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/sharepoint/4.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 SPWeb正在处理自己并导致异常_Sharepoint_Exception_Dispose - Fatal编程技术网

Sharepoint SPWeb正在处理自己并导致异常

Sharepoint SPWeb正在处理自己并导致异常,sharepoint,exception,dispose,Sharepoint,Exception,Dispose,当尝试使用SPWeb.GetSiteDataSpSitedDataQuery尝试将某些数据绑定到SPGridView时,它会抛出带有以下stacktrace的TargetInvocationException: 例外 正在开票的方法是GetData。在使用来自HRESULT:0x80020009 DISP_E_Exception的消息Exception调查InnerException后,SharePoint似乎希望释放以下资源: at Microsoft.SharePoint.Librar

当尝试使用SPWeb.GetSiteDataSpSitedDataQuery尝试将某些数据绑定到SPGridView时,它会抛出带有以下stacktrace的TargetInvocationException:

例外 正在开票的方法是GetData。在使用来自HRESULT:0x80020009 DISP_E_Exception的消息Exception调查InnerException后,SharePoint似乎希望释放以下资源:

   at Microsoft.SharePoint.Library.SPRequest.ReleaseResources()
   at Microsoft.SharePoint.SPRequestManager.Release(SPRequest request)
   at Microsoft.SharePoint.SPWeb.Invalidate()
   at Microsoft.SharePoint.SPWeb.Close()
   at Microsoft.SharePoint.SPWeb.Dispose()
   at Balticovo.SharePoint.Extensions.GetCrossSiteData(SPWebApplication webApp, SPCrossSiteDataQuery query)
   at Balticovo.SharePoint.TasksTableAdapter.GetData(Guid queryId, Boolean dataForOutlook)
   at Balticovo.SharePoint.TasksTableAdapter.GetData(Guid queryId)
但是所有这些方法直到SPWeb.Dispose我在调用SPWeb.getSiteDataSpSitedDataQuery之前都不会处理任何东西,然后它会抛出一个异常

我的代码 我得到的SPWebApplication实例如下-Microsoft.SharePoint.WebControls.SPControl.GetContextWebApplicationHttpContext.Current

然后我在函数GetCrossSiteData中执行类似的操作:

foreach (string siteUrl in query.QuerySites)
{
   try
   {
      using (SPSite site = new SPSite(siteUrl))
      using (SPWeb web = site.OpenWeb())
      {
         DataTable dt = web.GetSiteData(query.SiteDataQuery); //Hangs here
         ....
      }
   }
}

有什么想法吗?谢谢。

原来原因是,对于某些列表,TemplateFeatureId属性被设置为一个实际上不存在或以某种方式更改的模板。在我的例子中,我刚刚重新创建了这些列表,现在查询运行良好

这篇文章发现了这一点:


只是不要用那个工具来解决问题——他说他正在修改内容数据库,我想是直接修改的。这是一个禁忌。我只是用它来看看哪些列表有问题。

这段代码是从哪里执行的?这是申请页面吗?它部署在哪里?
foreach (string siteUrl in query.QuerySites)
{
   try
   {
      using (SPSite site = new SPSite(siteUrl))
      using (SPWeb web = site.OpenWeb())
      {
         DataTable dt = web.GetSiteData(query.SiteDataQuery); //Hangs here
         ....
      }
   }
}