C#-MVC 2和.NET 4.0的AllowPartiallyTrustedCallersAttribute错误
作者:互联网
Assembly ‘Foo.BAL, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null’
is marked with the
AllowPartiallyTrustedCallersAttribute,
and uses the level 2 security
transparency model. Level 2
transparency causes all methods in
AllowPartiallyTrustedCallers
assemblies to become security
transparent by default, which may be
the cause of this exception.Description: An unhandled exception
occurred during the execution of the
current web request. Please review the
stack trace for more information about
the error and where it originated in
the code.
我有一个标准业务层调用我的数据访问层,为什么在MVC 2和.NET 4.0中会出现此错误?
我使用的是Enterprise Block,所以我放弃了它,现在只使用标准的System.Data.SqlClient API来最大程度地减少依赖性.
编辑:如果将我的BAL和DAL项目上的目标框架更改为3.5,我不会收到错误.
解决方法:
在.NET 3.5和.NET 4之间,安全模型发生了巨大变化.
http://msdn.microsoft.com/en-us/library/dd233103.aspx
标签:security,asp-net,c,asp-net-mvc,net-4-0 来源: https://codeday.me/bug/20191209/2097531.html