![](/img/trans.png)
[英]NHibernate ERROR Message Invalid index 4 for this SqlParameterCollection with Count=4
[英]error message not in development but rather in deployment using NHibernate version 2.1.1.4000
我看了看
无法加载类型'NHibernate.ByteCode.Castle.ProxyFactoryFactory,NHibernate.ByteCode.Castle'
部署后运行单元测试时,我也遇到相同的错误消息,但是我的应用程序运行良好。 即使在开发期间,我也没有任何此类错误。
怎么了? 为什么在运行单元测试时出现此错误消息?
错误消息如下:
NHibernate.Bytecode.ProxyFactoryFactoryNotConfiguredException:该ProxyFactoryFactory没有配置。 使用可用的NHibernate.ByteCode提供程序之一初始化会话工厂配置部分的'proxyfactory.factory_class'属性。 示例:NHibernate.ByteCode.LinFu.ProxyFactoryFactory,NHibernate.ByteCode.LinFu示例:NHibernate.ByteCode.Castle.ProxyFactoryFactory,NHibernate.ByteCode.Castle]]>---
]]>
连接字符串为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>
该dll是:
我有NHIbernate版本2.1.1.4000,我有NHibernate.ByteCode.Castle版本2.1.1.4000,Castle.Core 1.1.0,Castle.DynamicProxy2.dll版本2.1.1.0
您正在使用哪个版本的NHibernate? 版本3.2预先配置了代理工厂。 如果使用的是此版本,则不再需要proxyfactory.factory_class配置选项。
另外,如果您的测试失败了,但是您的应用程序却没有失败,那么也许测试无法访问正确的休眠配置文件。 如果以编程方式进行配置,请再次查看它以确认是否已设置代理因子(如果使用NH <3.2)或未设置代理因子(如果使用NH> = 3.2)...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.