sharepoint 中添加webpart 报"Unable to add selected web part(s)...."

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

 

在此感谢原作者!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值