简体   繁体   中英

error message not in development but rather in deployment using NHibernate version 2.1.1.4000

I have had a look at

Unable to load type 'NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle'

I am also having the same error message when running the unit tests after deployment, however my application is running fine. Even during development, I am not having any such error.

What is wrong? Why I am having this error message when running the unit test?

The error message is as follows:

NHibernate.Bytecode.ProxyFactoryFactoryNotConfiguredException : The ProxyFactoryFactory was not configured. Initialize 'proxyfactory.factory_class' property of the session-factory configuration section with one of the available NHibernate.ByteCode providers. Example: NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu Example: NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle ]]> - -

]]>

Connection string is web.config

> > <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
>     <session-factory>
>       <property name="dialect">NHibernate.Dialect.MsSql2000Dialect</property>
>       <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
>       <property name="connection.connection_string">Server=localhost\SQLServer2005;Database=testDev;</property>
>       <property name='proxyfactory.factory_class'>NHibernate.ByteCode.Castle.ProxyFactoryFactory,
> NHibernate.ByteCode.Castle</property>
>     </session-factory>   </hibernate-configuration>

The dll are:

I have NHIbernate version 2.1.1.4000, and I have NHibernate.ByteCode.Castle version 2.1.1.4000 ,Castle.Core 1.1.0, Castle.DynamicProxy2.dll version 2.1.1.0

Which version of NHibernate are you using? Version 3.2 comes pre-configured with a proxy factory. If you are using this version, you no longer need the proxyfactory.factory_class configuration option.

Also, if your tests are failing but not your app, then maybe the tests are not able to access the right hibernate config file. If you are doing the configuration programmatically, look at it once again to verify the proxy factor is set (if using NH < 3.2) or not set (if using NH >= 3.2) ...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM