2009-09-24 95 views
0

有没有人有以下流利配置错误的经验?创建连贯NHibernate会话工厂时出错

faultString =“在创建一个会话使用了无效的或不完整的配置。检查PotentialReasons集合,的InnerException了解更多详情。

我有我的开发没有问题,但是当这些DLL被放在了生产服务器和测试,发生错误。

发展框是在相同的数据库指向,所以我不认为在架构差异的问题。

另外,是否有人知道是否有流利的nhibernate文档?

任何指针非常赞赏。

这里是内部异常抛出:

System.TypeInitializationException: The type initializer for 'NHibernate.ByteCode.Castle.ProxyFactory' threw an exception. ---> System.Security.SecurityException: That assembly does not allow partially trusted callers. 

    at Castle.DynamicProxy.ModuleScope..ctor(Boolean savePhysicalAssembly, String strongAssemblyName, String strongModulePath, String weakAssemblyName, String weakModulePath) 

    at Castle.DynamicProxy.ModuleScope..ctor(Boolean savePhysicalAssembly) 

    at Castle.DynamicProxy.ProxyGenerator..ctor() 

    at NHibernate.ByteCode.Castle.ProxyFactory..cctor() 

The action that failed was: 

LinkDemand 

The Zone of the assembly that failed was: 

MyComputer 

    --- End of inner exception stack trace --- 

    at NHibernate.ByteCode.Castle.ProxyFactory..ctor() 

    at NHibernate.ByteCode.Castle.ProxyFactoryFactory.BuildProxyFactory() 

    at NHibernate.Tuple.Entity.PocoEntityTuplizer.BuildProxyFactoryInternal(PersistentClass class, IGetter getter, ISetter setter) 

    at NHibernate.Tuple.Entity.PocoEntityTuplizer.BuildProxyFactory(PersistentClass persistentClass, IGetter idGetter, ISetter idSetter) 

    at NHibernate.Tuple.Entity.AbstractEntityTuplizer..ctor(EntityMetamodel entityMetamodel, PersistentClass mappingInfo) 

    at NHibernate.Tuple.Entity.PocoEntityTuplizer..ctor(EntityMetamodel entityMetamodel, PersistentClass mappedEntity) 

    at NHibernate.Tuple.Entity.EntityEntityModeToTuplizerMapping..ctor(PersistentClass mappedEntity, EntityMetamodel em) 

    at NHibernate.Tuple.Entity.EntityMetamodel..ctor(PersistentClass persistentClass, ISessionFactoryImplementor sessionFactory) 

    at NHibernate.Persister.Entity.AbstractEntityPersister..ctor(PersistentClass persistentClass, ICacheConcurrencyStrategy cache, ISessionFactoryImplementor factory) 

    at NHibernate.Persister.Entity.SingleTableEntityPersister..ctor(PersistentClass persistentClass, ICacheConcurrencyStrategy cache, ISessionFactoryImplementor factory, IMapping mapping) 

    at NHibernate.Persister.PersisterFactory.CreateClassPersister(PersistentClass model, ICacheConcurrencyStrategy cache, ISessionFactoryImplementor factory, IMapping cfg) 

    at NHibernate.Impl.SessionFactoryImpl..ctor(Configuration cfg, IMapping mapping, Settings settings, EventListeners listeners) 

    at NHibernate.Cfg.Configuration.BuildSessionFactory() 

    at FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory() in d:\Builds\FluentNH\src\FluentNHibernate\Cfg\FluentConfiguration.cs:line 93" 
    message = "faultCode:Server.Processing faultString:'System.TypeInitializationException: The type initializer for 'NHibernate.ByteCode.Castle.ProxyFactory' threw an exception. ---> System.Security.SecurityException: That assembly does not allow partially trusted callers. 

    at Castle.DynamicProxy.ModuleScope..ctor(Boolean savePhysicalAssembly, String strongAssemblyName, String strongModulePath, String weakAssemblyName, String weakModulePath) 

    at Castle.DynamicProxy.ModuleScope..ctor(Boolean savePhysicalAssembly) 

    at Castle.DynamicProxy.ProxyGenerator..ctor() 

    at NHibernate.ByteCode.Castle.ProxyFactory..cctor() 

The action that failed was: 

LinkDemand 

The Zone of the assembly that failed was: 

MyComputer 

    --- End of inner exception stack trace --- 

    at NHibernate.ByteCode.Castle.ProxyFactory..ctor() 

    at NHibernate.ByteCode.Castle.ProxyFactoryFactory.BuildProxyFactory() 

    at NHibernate.Tuple.Entity.PocoEntityTuplizer.BuildProxyFactoryInternal(PersistentClass class, IGetter getter, ISetter setter) 

    at NHibernate.Tuple.Entity.PocoEntityTuplizer.BuildProxyFactory(PersistentClass persistentClass, IGetter idGetter, ISetter idSetter) 

    at NHibernate.Tuple.Entity.AbstractEntityTuplizer..ctor(EntityMetamodel entityMetamodel, PersistentClass mappingInfo) 

    at NHibernate.Tuple.Entity.PocoEntityTuplizer..ctor(EntityMetamodel entityMetamodel, PersistentClass mappedEntity) 

    at NHibernate.Tuple.Entity.EntityEntityModeToTuplizerMapping..ctor(PersistentClass mappedEntity, EntityMetamodel em) 

    at NHibernate.Tuple.Entity.EntityMetamodel..ctor(PersistentClass persistentClass, ISessionFactoryImplementor sessionFactory) 

    at NHibernate.Persister.Entity.AbstractEntityPersister..ctor(PersistentClass persistentClass, ICacheConcurrencyStrategy cache, ISessionFactoryImplementor factory) 

    at NHibernate.Persister.Entity.SingleTableEntityPersister..ctor(PersistentClass persistentClass, ICacheConcurrencyStrategy cache, ISessionFactoryImplementor factory, IMapping mapping) 

    at NHibernate.Persister.PersisterFactory.CreateClassPersister(PersistentClass model, ICacheConcurrencyStrategy cache, ISessionFactoryImplementor factory, IMapping cfg) 

    at NHibernate.Impl.SessionFactoryImpl..ctor(Configuration cfg, IMapping mapping, Settings settings, EventListeners listeners) 

    at NHibernate.Cfg.Configuration.BuildSessionFactory() 

    at FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory() in d:\Builds\FluentNH\src\FluentNHibernate\Cfg\FluentConfiguration.cs:line 93' faultDetail:'null'" 
    name = "Error" 
    rootCause = (null) 

FluorineStackTrace: 

undefined 
+1

功能NHibernate文档:http://wiki.fluentnhibernate.org/Main_Page – 2009-09-24 02:37:37

+0

感谢您的帮助,我已经描绘出内部异常并将其添加到原始帖子中。不知道下一步该怎么做。 – Chin 2009-09-24 04:08:50

回答

2

我认为这是接近约信任这样一个问题:

NHibernate 2 + Fluent Nhibernate medium trust

的问题是不是流利NHibernate的,但城堡动态代理2.我个人对我部署到环境的充分信任所以我没有必要解决它。

你的选择是:

  • 获得更新的城堡动态代理,使这是固定的。
  • 尝试另一个代理。
  • 使用预生成的nhibernate代理工厂。

你应该能够找到所有的这些职位上nhforge.org