2009-09-24 2 views
0

Есть ли у кого-нибудь опыт в следующей безопасной ошибке конфигурации?Ошибка при создании Fluent NHibernate Session factory

faultString = «Недопустимая или неполная конфигурация была использована при создании SessionFactory. Проверьте коллекцию PotentialReasons и InnerException более подробно.

У меня нет никаких проблем, на моем ящике развития, но когда динамические библиотеки вывешиваются на сервере и испытано, происходит ошибка.

коробка развития указывает на той же базе данных, так что я не думаю, что различия в схеме, являются проблемой.

Кроме того, знает ли кто-нибудь, есть ли какая-либо документация для свободного 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

Fluent NHibernate документы: http://wiki.fluentnhibernate.org/Main_Page –

+0

Спасибо за вашу помощь, я начертил внутреннее исключение и добавило его в исходное сообщение. Не уверен, что делать дальше. – Chin

ответ

2

Я думаю, что это близко к этому вопросу о доверии:

NHibernate 2 + Fluent Nhibernate medium trust

Вопрос не о свободно NHibernate, но замок Dynamic Proxy 2. У меня лично полное доверие на условиях я развертывают в поэтому мне не пришлось ее разрешать.

Ваши варианты заключаются в следующем:

  • Получить обновленный замок Dynamic Proxy, так что это фиксировано.
  • Попробуйте другой прокси.
  • Используйте фабрику прокси-серверов с предварительной обработкой.

Вы должны быть в состоянии найти сообщения для всех из них на nhforge.org

0

Смотрите ответ на этот вопрос:

assembly does not allow partially trusted callers

Ваша машина развития, скорее всего, работает полное доверие, в то время как ваша машина производства, скорее всего, работает средний уровень доверия.