当我写好一个 webPart时! 部署到sharepoint里面! 但是在sharepoint 里面编辑页面点击 add a web webpart 按钮 时!找到在vs里面我写的webpart!点击添加按钮!出现了"Unable to add selected web part(s).

UCWebPart:Assembly that implement ASP.NET Web Parts and are installed into a partially into a partially trusted locaton,such as the bin directory ,must be compiled with the allowpartially trustedCallersAttribute set for import to succeed"这个对话框!

后来我检测端口下面的web.config里面的配置!

1. <SafeControl Assembly="Sample.SayHello, Version=1.0.0.0, Culture=neutral, PublicKeyToken=942df97ad6eaef86" Namespace="Sample.SayHello" TypeName="*" Safe="True" /> 注册为安全控件
2.  <trust level="Full" originUrl="" />  这里也改为full了!

3. 把webpart的dll放到 端口下面 bin目录里面!

检查以上都没有问题!

最后在http://space.cnblogs.com/group/topic/30669/找到了解决方案!

解决方案:

我们需要在该项目的AssemblyInfo.cs文件里添加 using System.Security引用 ,在最后添加一个 [assembly: AllowPartiallyTrustedCallers]!

最后测试OK!

在此感谢原作者!

相关文章:

  • 2021-10-12
  • 2021-06-04
  • 2022-12-23
  • 2022-02-06
  • 2021-12-28
  • 2021-08-11
  • 2021-07-21
  • 2021-08-29
猜你喜欢
  • 2022-12-23
  • 2021-12-19
  • 2022-12-23
  • 2021-09-08
  • 2022-01-08
  • 2021-05-17
  • 2022-12-23
相关资源
相似解决方案