简体   繁体   English

SharePoint 2010-此页面上的Web部件或Web窗体控件无法显示或导入。 该类型未注册为安全

[英]SharePoint 2010 - A Web Part or Web Form Control on this Page cannot be displayed or imported. The type is not registered as safe

I have been stuck on this error and am unable to solve it since the past few days. 自从过去几天以来,我一直陷在这个错误中,无法解决它。 I have googled all I could, but none of the solutions seems to work for me. 我已尽一切可能用Google搜索,但似乎没有一种解决方案适合我。 I'll go through all the steps I've done and hopefully, someone might be able to catch a mistake. 我将完成所有步骤,并希望有人可能会发现一个错误。 Also, I've been developing with SharePoint for quite a while now, but still a beginner in some parts. 另外,我已经使用SharePoint开发了相当长的时间,但是在某些方面还是一个初学者。

I have created my site in my SharePoint and created a new Site Collection for it. 我已经在SharePoint中创建了网站,并为其创建了一个新的网站集。 I deployed my web part with the following command in powershell: 我在powershell中使用以下命令部署了Web部件:

Update-SPSolution -Identity xxxxx.wsp -GACDeployment -LiteralPath "C:\Users\username\Desktop\xxxxx.wsp"

I then go to my created my site and add the web part. 然后,我转到创建的网站并添加Web部件。 Which alerts me with the following message. 哪条消息提示我。

I tried many solutions including, 我尝试了许多解决方案,包括:

  1. I checked if my Web part is declared as Safe in the web.config or my root site. 我检查了我的Web部件是否在web.config或根站点中被声明为“安全”。 It looks like this: 看起来像这样:

<SafeControl Assembly="xxxxx, Version=1.0.0.0, Culture=neutral, PublicKeyToken=4a87d6fcb45f5672" Namespace="xxxxx.xxx" TypeName="*" Safe="True" SafeAgainstScript="False" />

  1. My class name SharePointProject1.WebPartName is declared as public. 我的类名称SharePointProject1.WebPartName被声明为public。
  2. I've deployed the web part to the GAC by using -GACDeployment 我已经使用-GACDeployment将Web部件部署到了GAC。
  3. The namespace name is same as it is defined in my project. 名称空间名称与我的项目中定义的名称相同。

I also checked my Application Logs in the Event Viewer, but there are no errors mentioned there as well. 我还在事件查看器中检查了我的应用程序日志,但是这里也没有提到任何错误。

After all this, I have a feeling maybe it might be a problem with my User Profile Service creation, though I'm not very familiar with this side of SharePoint. 经历了所有这些之后,尽管我对SharePoint的这一方面不是很熟悉,但是我可能感觉这可能与我的User Profile Service创建有关。

I followed these two tutorials to create a User Profile Service & the My Site: http://sharepointgeorge.com/2010/configuring-the-user-profile-service-in-sharepoint-2010/ http://www.boostsolutions.com/blog/how-to-create-configure-my-sites-in-sharepoint-2010/ 我跟着这两个教程,以创建一个用户配置文件服务与我的网站: http://sharepointgeorge.com/2010/configuring-the-user-profile-service-in-sharepoint-2010/ HTTP://www.boostsolutions。 COM /博客/如何到创建-配置-我的网站,在SharePoint的-2010 /

I think the steps you have taken is proper and it should work. 我认为您采取的步骤是正确的,应该可以正常工作。 Cna you try one more thing. 您可以再尝试一件事。 Can you just go and remove that * sign for the TypeName ? 您可以删除TypeName的*符号吗?

  1. Go to your project and then in Package.package 转到您的项目,然后在Package.package中
  2. Go to Advanced tab,and click on Add to Add Existing Assembly 转到高级选项卡,然后单击添加以添加现有程序集
  3. Click on ... in source path and select your project dll file 在源路径中单击...,然后选择您的项目dll文件
  4. Select Deployment target as Gobal assembly cache 选择部署目标作为Gobal程序集缓存
  5. Under Safe Control Section, Give a NameSpace for the assembly and under Assembly give a full dll name 在“安全控制”部分下,为程序集命名空间,在“程序集”下给出完整的dll名称

Then try to deploy again 然后尝试再次部署

Let me know the result. 让我知道结果。

Edit: 编辑:
As per Comments Use this command to deploy the solution "stsadm -o deploysolution -name xxxxx.wsp -immediate -allowGacDeployment -force -allcontenturls" 按照注释使用此命令来部署解决方案“ stsadm -o deploysolution -name xxxxx.wsp -immediate -allowGacDeployment -force -allcontenturls”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Web 部件错误:无法显示或导入此页面上的 Web 部件或 Web 窗体控件 - Web Part Error: A Web Part or Web Form Control on this Page cannot be displayed or imported 将内容编辑器Web部件添加到sharepoint 2010用户控件 - Add content editor web part to a sharepoint 2010 user control FieldValidators和Visual Web部件(Sharepoint 2010) - FieldValidators and Visual Web Part (Sharepoint 2010) Sharepoint 2010中的自定义AnnouncementListItem可视Web部件 - Custom AnnouncementListItem Visual Web Part in Sharepoint 2010 sharepoint 2010自定义新列表表单(列表表单Web部件)按钮 - sharepoint 2010 customize new list form (list form web part) buttons 有什么方法可以将用户控件中的对象代码用作Sharepoint 2010 Web部件中新对象的模板? - Any way to use object code in a User Control as a template for a new Object in a Sharepoint 2010 web part? SharePoint错误:“无法导入Web部件” - SharePoint error: “Cannot import Web Part” 以编程方式在Sharepoint中实例化Web部件页面 - Programmatically instantiate a web part page in Sharepoint 是否可以在Web部件中使用多线程访问SharePoint 2010列表? - Is it possible to access a SharePoint 2010 list using multi threading in a web part? 在SharePoint 2010 Web部件中模拟用户以调用WCF服务 - Impersonate User in SharePoint 2010 web part to call WCF service
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM