我在使用共享虚拟主机时遇到以下错误:
"System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.ReflectionPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."我认为这应该和AutoMapper有关。我该如何解决这个问题呢?
遵循堆栈跟踪:
[SecurityException: Request for the permission of type 'System.Security.Permissions.ReflectionPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) +0
System.Security.CodeAccessSecurityEngine.Check(CodeAccessPermission cap, StackCrawlMark& stackMark) +31
System.Security.CodeAccessPermission.Demand() +46
System.Reflection.Emit.DynamicMethod.PerformSecurityCheck(Type owner, StackCrawlMark& stackMark, Boolean skipVisibility) +9453167
System.Reflection.Emit.DynamicMethod..ctor(String name, Type returnType, Type[] parameterTypes, Type owner, Boolean skipVisibility) +40
AutoMapper.DelegateFactory.CreateDynamicMethod(MemberInfo member, Type sourceType) +291
AutoMapper.DelegateFactory.CreateSet(PropertyInfo property) +52
AutoMapper.Internal.PropertyAccessor..ctor(PropertyInfo propertyInfo) +64
AutoMapper.ReflectionHelper.ToMemberAccessor(MemberInfo accessorCandidate) +209
AutoMapper.TypeMapFactory.CreateTypeMap(Type sourceType, Type destinationType, IMappingOptions options) +256
AutoMapper.ConfigurationStore.CreateTypeMap(Type source, Type destination, String profileName) +83
AutoMapper.ConfigurationStore.CreateMap(String profileName) +92
AutoMapper.ConfigurationStore.CreateMap() +53
AutoMapper.Mapper.CreateMap() +76发布于 2012-01-11 02:55:16
只需将这一行添加到Web.Config中,问题就解决了。http://msdn.microsoft.com/en-us/library/tkscy493.aspx
<trust level="Full" originUrl="" />https://stackoverflow.com/questions/8808673
复制相似问题