AllowPartiallyTrustedCallersAttribute Error with MVC 2 and .NET 4.0

Assembly 'Foo.BAL, Version = 1.0.0.0, Culture = Neutral, PublicKeyToken = null' is marked by AllowPartiallyTrustedCallersAttribute, and uses level 2 transparency protection. Level 2 transparency calls all methods in the AllowPartiallyTrustedCallers assembly to ensure the security is transparent by default, which may be the reason for 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 occurred in the code.

I have a standard business layer invoking my data access level, why am I getting this error with MVC 2 and .NET 4.0?

I used Enterprise Block, so I dropped it, and now I just use the standard System.Data.SqlClient APIs to minimize dependencies.

EDIT: if I change the target structure in my BAL and DAL projects to 3.5, I do not get an error.

+3
source share
1 answer

The security model has changed significantly between .NET 3.5 and .NET 4.

http://msdn.microsoft.com/en-us/library/dd233103.aspx

+3
source

Source: https://habr.com/ru/post/1757267/


All Articles