ICode9

精准搜索请尝试: 精确搜索
首页 > 编程语言> 文章详细

C#-MVC 2和.NET 4.0的AllowPartiallyTrustedCallersAttribute错误

2019-12-09 23:07:30  阅读:342  来源: 互联网

标签:security asp-net c asp-net-mvc net-4-0


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

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有