开发者

Allowing partially trusted callers security exception is been thrown althought running on Full trust mode

While developing using ASP.net 2.0 (C#) and NHibernate 2.1.0 I am getting the error:

System.TypeInitializationException: The type initializer for 'NHibernate.ByteCode.LinFu.ProxyFactory' threw an exception. ---> System.Security.SecurityException: That assembly does not allow partially trusted callers.

This error is been thrown only in the production server (a web hosting company) and in my development environment everything is fine.

I also ran this code below on the production server to see the Code Access Security (CAS) level and got True from:

System.Security.SecurityManager.IsGranted(new AspNetHostingPermission(AspNetHostingPermissionLevel.Unrestricted))

so I can assume I am currently running in a full trusted mode..

After reading some articles about this kind of problem (not specifically for NHibernate) I understood that I need to add

[a开发者_开发问答ssembly: AllowPartiallyTrustedCallers()]

to my AssebmlyInfo.cs file.

My question is: Is there a way to solve this exception without having to edit the NHibernate.ByteCode.LinFu.dll's AssmeblyInfo.cs ? Is there something that can be configured in the web.config to allow this kind of action?

Thanks,

Tal.


Have you tried the steps called out here?

Using NHibernate in a Medium Trust web environment

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜