NHibernate无法加载Proxy Factory [英] NHibernate unable to load Proxy Factory

查看:175
本文介绍了NHibernate无法加载Proxy Factory的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我非常困惑,试图让一个简单的NHibernate应用程序运行。我正在逐步开始使用NHibernate。
首先,我收到一个无效的属性一些错误(可以修复)。

I'm so stuck with trying to get a simple NHibernate app running. I'm doing "Getting started with NHibernate" step by step. First, I got a invalid property something error (managed to fix that).

现在我收到一个例外:

在配置代理工厂类期间无法加载类型'NHibernate.ByteCode.Castle.ProxyFactoryFactory,NHibernate.ByteCode.Castle'

可能的原因是
- 未部署NHibernate.Bytecode提供程序集合。
- 用于初始化会话工厂部分的proxyfactory.factory_class属性的typeName格式不正确。

Possible causes are: - The NHibernate.Bytecode provider assembly was not deployed. - The typeName used to initialize the 'proxyfactory.factory_class' property of the session-factory section is not well formed.

解决方案: strong>
确认您的部署文件夹包含以下程序集之一:
NHibernate.ByteCode.LinFu.dll
NHibernate.ByteCode.Castle.dll

Solution: Confirm that your deployment folder contains one of the following assemblies: NHibernate.ByteCode.LinFu.dll NHibernate.ByteCode.Castle.dll"

所提到的文件位于QuickStart.dll所在的Bin文件夹中
我没有任何线索为什么会发生这种情况!
我在我的智慧结束时间花了几个小时尝试
SO的问题(无法加载类型'NHibernate.ByteCode.LinFu.ProxyFactoryFactory,NHibernate.ByteCode.LinFu')没有帮助:(

The files mentioned are in the Bin folder, where the QuickStart.dll is. I have no clue why this is happening! I'm at my wits end spending hours today trying to get this to work. The question at SO (Unable to load type ‘NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu’) did not help :(

休眠配置来自Web.config:

The hibernate configuration from 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.driver_class">NHibernate.Driver.SqlClientDriver</property>
        <property name="connection.connection_string">Server=(local);initial catalog=quickstart;Integrated Security=SSPI</property>
        <property name="connection.isolation">ReadCommitted</property>
        <property name="default_schema">Monitor.dbo</property>
        <property name='proxyfactory.factory_class'>NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property>
        <!-- HBM Mapping Files -->
        <mapping assembly="QuickStart"/>
    </session-factory>
</hibernate-configuration>


推荐答案

由于您的配置文件配置NHiberante使用Castle动态代理,您将需要您的bin文件夹中的NHibernate.ByteCode.Castle.dll,请确保您在应用程序中引用此DLL,并将其复制到项目输出路径。

Since your configuration file configures NHiberante to use the Castle dynamic proxy you will need NHibernate.ByteCode.Castle.dll in your bin folder, make sure that you reference this dll in your application and that it is copied to your project output path.

如果您的问题仍然存在,请启用融合日志并检查NHibernate在哪里查找dll。

If your problem remains please enable the fusion log and check where NHibernate is looking for the dll.

这篇关于NHibernate无法加载Proxy Factory的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆