NHibernate.Bytecode.UnableToLoadProxyFactoryFactoryException [英] NHibernate.Bytecode.UnableToLoadProxyFactoryFactoryException
问题描述
我在启动程序中设置了以下代码
I have the following code set up in my Startup
IDictionary<string, string> properties = new Dictionary<string, string>();
properties.Add("connection.driver_class", "NHibernate.Driver.SqlClientDriver");
properties.Add("dialect", "NHibernate.Dialect.MsSql2005Dialect");
properties.Add("proxyfactory.factory_class", "NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle");
properties.Add("connection.provider", "NHibernate.Connection.DriverConnectionProvider");
properties.Add("connection.connection_string", "Data Source=ZEUS;Initial Catalog=mydb;Persist Security Info=True;User ID=sa;Password=xxxxxxxx");
InPlaceConfigurationSource source = new InPlaceConfigurationSource();
source.Add(typeof(ActiveRecordBase), (IDictionary<string, string>) properties);
Assembly asm = Assembly.Load("Repository");
Castle.ActiveRecord.ActiveRecordStarter.Initialize(asm, source);
我遇到以下错误:
failed: NHibernate.Bytecode.UnableToLoadProxyFactoryFactoryException : Unable to load type 'NNHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle' during configuration of proxy factory class.
failed: NHibernate.Bytecode.UnableToLoadProxyFactoryFactoryException : Unable to load type 'NNHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle' during configuration of proxy factory class.
可能的原因是:
- 未部署NHibernate.Bytecode提供程序程序集.
- 用于初始化session-factory部分的'proxyfactory.factory_class'属性的typeName格式不正确.
我已阅读并阅读了我所引用的所有程序集列出的我完全不知所措.
I have read and read I am referecning the All the assemblies listed and I am at a total loss as what to try next.
Castle.ActiveRecord.dll
Castle.DynamicProxy2.dll
Iesi.Collections.dll
log4net.dll
NHibernate.dll
NHibernate.ByteCode.Castle.dll
Castle.Core.dll.
Castle.ActiveRecord.dll
Castle.DynamicProxy2.dll
Iesi.Collections.dll
log4net.dll
NHibernate.dll
NHibernate.ByteCode.Castle.dll
Castle.Core.dll.
我100%确定组件在垃圾箱中.有人有什么想法吗?
I am 100% sure the assembly is in the bin. Anyone have any ideas?
推荐答案
使用与您的项目不同的目标平台构建NHibernate.ByteCode.Castle.dll时,会发生此问题.要对此进行测试,请从以下一项或多项更改程序目标平台:
This problem occurs when NHibernate.ByteCode.Castle.dll was built with a different target platform as your project. To test this, change your program target platform from one or more of the following:
- 从x64到x86
- x86至x64
- 任何CPU"到x86
- 任何CPU"到x64
如果其中任何一个解决了您的问题,那么您就知道您只需要同步DLL和目标平台即可.
If any of those solve your problem, then you know that you just need to synchronize the DLL and your target platform.
这篇关于NHibernate.Bytecode.UnableToLoadProxyFactoryFactoryException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!