Security Exception when using LINQ to Entities
I've built an MVC 2 application (ASP.net 3.5) using Entity Framework, and am doing my querying with LINQ. I'm trying to deploy to a shared host (1&1). The only (possibly) relevant restriction I'm aware of is that they don't allow unmanaged code, thoug开发者_StackOverflowh I'm not using any to my knowledge.
Here are the last couple lines of my stack trace:
[SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
System.Data.Objects.LightweightCodeGenerator.ValidateSetterProperty(RuntimeMethodHandle setterMethodHandle, MethodInfo& setterMethodInfo, Type& realType) +28
System.Data.Common.Internal.Materialization.Translator.CreatePropertyBindings(StructuredColumnMap columnMap, Type clrType, ReadOnlyMetadataCollection`1 properties) +142
....
I do not have the option of setting my application to Full trust.
My question now is this: is using Linq-to-entities still possible in my environment? If not, what alternatives are there that would require the least rework? Entity Framework is handling things like validation for me, so I'd like not to have to scrap it.
if you go here: http://msdn.microsoft.com/en-us/library/cc716760.aspx and search for full-trust word, you will see all basic rights EF needs to run when in partial trust mode.
精彩评论