JOJ
踏踏实实做人,认认真真做事!放纵自己就是毁灭自己!

当我写好一个 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!

在此感谢原作者!

posted on 2010-04-03 18:14  JoinJ  阅读(312)  评论(0编辑  收藏  举报