That assembly does not allow partially trusted callers.

主机信任级别受限security policy,That assembly does not allow partially trusted callers.

http://www.cmszs.com/2010/07/security-policy-that-assembly-does-not-allow-partially-trusted-callers/

 

新写了一个asp.net的测试程序,用到第三方dll文件,放到了godaddy的windows主机上,出现以下异常

Security Exception
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

Exception Details: System.Security.SecurityException: That assembly does not allow partially trusted callers.

这是因为很多主机服务商把信任级别设为了Medium,而应用三方dll却需要full信任级别。如果不能让服务商更改信任级别,可以尝试通过以下方法解决。

如果你的dll有源码,打开源代码
更改AssemblyInfo.cs 文件,加入下列代码
using System.Security;
using System.Security.Permissions;
[assembly: AllowPartiallyTrustedCallers]

从新生产dll文件。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值