That assembly does not allow partially trusted callers.
2012-06-20 18:16
465 查看
主机信任级别受限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文件。
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文件。
相关文章推荐
- 解决连接MySQL时出现securityException异常,并且会有"That assembly does not allow partially trusted callers"的异常信息
- Exception: That assembly does not allow partially trusted callers.
- AllowPartiallyTrustedCallersAttribute 类的用法(msdn)
- .NET : 什么是AllowPartiallyTrustedCallers
- 如何使用 AllowPartiallyTrustedCallers 属性来调用具有一个强名称从 Web 页通过使用 Visual C#.NET、 Visual C# 2005年或更高版本的程序集
- .NET : 什么是AllowPartiallyTrustedCallers
- SyntaxError:Strict mode does not allow function declaration in a lexically nested statement.
- org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transac
- 解决No Hibernate Session bound to thread, and configuration does not allow creation of non-transaction
- SyntaxError:Strict mode does not allow function declaration in a lexically nested statement.
- 【MySQL案例】error.log的Warning:If a crash happens thisconfiguration does not guarantee that the relay lo
- 错误 the type "xxxx" is defined in an assembly that is not refernced.You must add a reference to assem
- 【iOS开发】This application's application-identifier entitlement does not match that of the installed ap
- 解决ffmpeg.exe转换问题flv does not support that sample
- No Hibernate Session bound to thread, and configuration does not allow creation
- Code First 经常出现 Model compatibility cannot be checked because the database does not contain model metadata. Ensure that IncludeMetadataConvention has
- 三大框架整合异常之No Hibernate Session bound to thread, and configuration does not allow creation of non-tran
- 解决 No Hibernate Session bound to thread, and configuration does not allow。
- Base class does not contain a constructor that takes '0' argument
- iOS-This application’s application-identifier entitlement does not match that of the installed appl