当前位置:  开发笔记 > 编程语言 > 正文

SharePoint错误:"无法导入Web部件"

如何解决《SharePoint错误:"无法导入Web部件"》经验,为你挑选了2个好方法。

我有一个我开发的Web部件,如果我手动安装Web部件就可以了.

但是,当我按照本网站上的说明打包Web部件作为指南时:http: //www.theartofsharepoint.com/2007/05/how-to-build-solution-pack-wsp.html

我在日志文件中收到此错误:

09/23/2008 14:13:03.67  w3wp.exe (0x1B5C)                           0x1534  Windows SharePoint Services     Web Parts                       8l4d    Monitorable Error importing WebPart. Cannot import Project Filter.   
09/23/2008 14:13:03.67  w3wp.exe (0x1B5C)                           0x1534  Windows SharePoint Services     Web Parts                       89ku    High        Failed to add webpart http%253A%252F%252Fuk64p12%252FPWA%252F%255Fcatalogs%252Fwp%252FProjectFilter%252Ewebpart;Project%2520Filter.  Exception Microsoft.SharePoint.WebPartPages.WebPartPageUserException: Cannot import Project Filter.     at Microsoft.SharePoint.WebPartPages.WebPartImporter.CreateWebPart(Boolean clearConnections)     at Microsoft.SharePoint.WebPartPages.WebPartImporter.Import(SPWebPartManager manager, XmlReader reader, Boolean clearConnections, Uri webPartPageUri, SPWeb spWeb)     at Microsoft.SharePoint.WebPartPages.WebPartImporter.Import(SPWebPartManager manager, XmlReader reader, Boolean clearConnections, SPWeb spWeb)     at Microsoft.SharePoint.WebPartPages.WebPartQuickAdd.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(...  
09/23/2008 14:13:03.67* w3wp.exe (0x1B5C)                           0x1534  Windows SharePoint Services     Web Parts                       89ku    High        ...String eventArgument)     

相关的是:

http%253A%252F%252Fuk64p12%252FPWA%252F%255Fcatalogs%252Fwp%252FProjectFilter%252Ewebpart;Project%2520Filter.
Exception Microsoft.SharePoint.WebPartPages.WebPartPageUserException: Cannot import Project Filter.
at Microsoft.SharePoint.WebPartPages.WebPartImporter.CreateWebPart(Boolean clearConnections)
at Microsoft.SharePoint.WebPartPages.WebPartImporter.Import(SPWebPartManager manager, XmlReader reader, Boolean clearConnections, Uri webPartPageUri, SPWeb spWeb)
at Microsoft.SharePoint.WebPartPages.WebPartImporter.Import(SPWebPartManager manager, XmlReader reader, Boolean clearConnections, SPWeb spWeb)
at Microsoft.SharePoint.WebPartPages.WebPartQuickAdd.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)

这伴随着一个相当简洁的错误消息:"无法导入Web部件".

我已检查并且我的.dll已注册为安全,它在GAC中,该功能已激活,并且Web部件显示在Web部件库中,其中所有正确的属性显示已成功读取webpart文件.

一切似乎都已到位,但我得到了这个错误,并且很少有关于如何解决它的解释.

任何寻求解决方案的帮助表示赞赏.



1> 小智..:

弄清楚了.

错误消息是.webpart文件中的错误消息:



  
    
      
      
      Cannot import Project Filter.
    
    
      
        Project Filter
        Provides a list of Projects that can be used to Filter other Web Parts.
      
    
  

问题是原始.webpart文件是在安装了Visual Studio Extensions for WSS的32位系统上创建的.

但是,由于我现在使用的是64位计算机VSEWSS不可用,并且我认为导致上述GUID没有被替换,因为我没有使用这些部署工具.

使用完整类型名称替换GUID有效.

因此,如果您遇到importErrorMessage节点的错误消息,请检查.webpart文件中的类型节点是否更像这样(不相关的示例):


其格式为:Class,Namespace,Version,Culture,PublicKey

您可以从与SharePoint实例关联的web.config文件中轻松获取该文件,因为它将位于安全控件列表中.



2> Kirk Liemohn..:

我们遇到了同样的问题,发现Web部件的构造函数是由WebPartImporter调用的,在构造函数中我们正在执行SPSecurity.RunWithElevatedPrivileges.

由于某种原因,WebPartImporter无法处理此问题.所以,我们只是将我们的代码从构造函数移到OnInit(它真正属于的地方),一切都很好.

推荐阅读
郑小蒜9299_941611_G
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有