gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-30 16:33:18 25 4
gpt4 key购买 nike

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

关于c# - MVC 2 和 .NET 4.0 的 AllowPartiallyTrustedCallersAttribute 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3368254/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com