我很想試着獲得一個簡單的NHibernate應用程序運行。我正在逐步完成「NHibernate入門」。 首先,我得到了一個無效的屬性錯誤(設法解決這個問題)。NHibernate無法加載代理工廠
現在,我得到一個異常:
無法加載類型 'NHibernate.ByteCode.Castle.ProxyFactoryFactory,NHibernate.ByteCode.Castle' 代理工廠類的配置過程。
可能的原因是: - 未部署NHibernate.Bytecode提供程序集。 - 用於初始化會話工廠部分的'proxyfactory.factory_class'屬性的typeName格式不正確。
解決方案: 確認您的部署文件夾包含以下組件之一: NHibernate.ByteCode.LinFu.dll NHibernate.ByteCode.Castle.dll」
提到的文件是在Bin文件夾,這裏的QuickStart.dll是。 我不知道爲什麼會發生這種情況! 我在我的智慧結束今天花幾個小時試圖讓這個工作。 SO(Unable to load type ‘NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu’)的問題沒有幫助:(
從Web.config中的Hibernate配置:
<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>
我猜想,經過幾個小時的修補之後,問題變成城堡和字節碼組件的錯誤版本被加載。非常感謝! – Liao 2009-12-16 18:12:29