我已在服务器上部署了服务上的WCF服务,并面临以下异常。
System.Security.SecurityException:请求类型为'System.Security.Permissions.ReflectionPermission,mscorlib,Version = 2.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089'的权限失败。
堆栈追踪:
[SecurityException: Request for the permission of type 'System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) +0
System.Security.CodeAccessPermission.Demand() +58
System.Reflection.Emit.DynamicMethod.PerformSecurityCheck(Type owner, StackCrawlMark& stackMark, Boolean skipVisibility) +160
System.Reflection.Emit.DynamicMethod..ctor(String name, Type returnType, Type[] parameterTypes, Type owner, Boolean skipVisibility) +40
NHibernate.Bytecode.Lightweight.ReflectionOptimizer.CreateDynamicMethod(Type returnType, Type[] argumentTypes) +179
NHibernate.Bytecode.Lightweight.ReflectionOptimizer.GenerateGetPropertyValuesMethod(IGetter[] getters) +326
NHibernate.Bytecode.Lightweight.ReflectionOptimizer..ctor(Type mappedType, IGetter[] getters, ISetter[] setters) +150
NHibernate.Bytecode.Lightweight.BytecodeProviderImpl.GetReflectionOptimizer(Type mappedClass, IGetter[] getters, ISetter[] setters) +62
NHibernate.Tuple.Component.PocoComponentTuplizer..ctor(Component component) +367
NHibernate.Tuple.Component.ComponentEntityModeToTuplizerMapping..ctor(Component component) +637
NHibernate.Tuple.Component.ComponentMetamodel..ctor(Component component) +528
NHibernate.Mapping.Component.BuildType() +65
NHibernate.Mapping.Component.get_Type() +72
NHibernate.Mapping.SimpleValue.IsValid(IMapping mapping) +52
NHibernate.Mapping.Property.IsValid(IMapping mapping) +56
NHibernate.Mapping.PersistentClass.Validate(IMapping mapping) +139
NHibernate.Mapping.RootClass.Validate(IMapping mapping) +45
NHibernate.Cfg.Configuration.ValidateEntities() +241
NHibernate.Cfg.Configuration.Validate() +30
NHibernate.Cfg.Configuration.BuildSessionFactory() +61
FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory() +49
现在我已应用以下配置并面临以下问题:
<section name="hibernate-configuration" requirePermission="false" type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate"/>
<section name="activerecord" requirePermission="false" type="Castle.ActiveRecord.Framework.Config.ActiveRecordSectionHandler, Castle.ActiveRecord"/>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<reflection-optimizer use="false" />
</hibernate-configuration>
堆栈追踪:
[SecurityException: That assembly does not allow partially trusted callers.]
Castle.DynamicProxy.ModuleScope..ctor(Boolean savePhysicalAssembly, String strongAssemblyName, String strongModulePath, String weakAssemblyName, String weakModulePath) +0
Castle.DynamicProxy.ModuleScope..ctor(Boolean savePhysicalAssembly) +35
Castle.DynamicProxy.ProxyGenerator..ctor() +38
NHibernate.ByteCode.Castle.ProxyFactory..cctor() +49
答案 0 :(得分:0)
您的托管服务提供商是否仅允许您以中等信任度运行?如果是这样,这意味着你只能反映公众成员,我相信。