2011-02-03 73 views
0

我在服務器上部署了WCF服務並面臨以下異常。面向安全權限問題

System.Security.SecurityException:請求「System.Security.Permissions.ReflectionPermission,mscorlib,Version = 2.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089」類型的權限失敗。

堆棧跟蹤:

[拋出:SecurityException:請求類型的權限 'System.Security.Permissions.ReflectionPermission,mscorlib程序,版本= 2.0.0.0,文化=中性公鑰= b77a5c561934e089' 失敗。] 系統.Security.CodeAccessSecurityEngine.Check(對象的需求,StackCrawlMark & stackMark,布爾isPermSet)0 System.Security.CodeAccessPermission.Demand()58 System.Reflection.Emit.DynamicMethod.PerformSecurityCheck(類型所有者,StackCrawlMark & stackMark,布爾skipVisibility)+160 System.Reflection.Emit.DynamicMethod..ctor(String name,Type returnType,類型[] parameterTypes,類型所有者,布爾skipVisibility)+40 NHibernate.Bytecode.Lightweight.ReflectionOptimizer.CreateDynamicMethod(Type returnType,Type [] argumentTypes)+179 NHibernate.Bytecode.Lightweight.ReflectionOptimizer.GenerateGetPropertyValuesMethod(IGetter [] getters) +類型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 (康波NENT成分)528 NHibernate.Mapping.Component.BuildType()65 NHibernate.Mapping.Component.get_Type()72 NHibernate.Mapping.SimpleValue.IsValid(IMapping映射)52 NHibernate.Mapping.Property。的IsValid(IMapping映射)56 NHibernate.Mapping.PersistentClass.Validate(IMapping映射)139 NHibernate.Mapping.RootClass.Validate(IMapping映射)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:那組件不允許部分可信賴呼叫者] Castle.DynamicProxy.ModuleScope..ctor(布爾savePhysicalAssembly,字符串strongAssemblyName,字符串strongModulePath,字符串weakAssemblyName, String weakModulePath)+0 Castle.DynamicProxy.ModuleScope..ctor(Boolean savePhysicalAssembly)+35 Castle.DynamicProxy.ProxyGenerator..ctor()+38 NHibernate.ByteCode.Castle.ProxyFactory ..cctor()+49

回答