我在 asp.net 4.0 项目中使用 NHibernate 3.0 和 SQL Server 2008 时遇到问题。 在 NHibernate 的配置任务期间,BuildSessionFactory() 方法引发异常:“无法找到请求的 .Net Framework 数据提供程序。它可能未安装。”
这是休眠配置文件:
<?xml version="1.0" encoding="utf-8" ?>
<!-- NHibernate Configuration -->
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="connection.provider">
NHibernate.Connection.DriverConnectionProvider
</property>
<property name="dialect">
NHibernate.Dialect.MsSql2008Dialect
</property>
<property name="connection.driver_class">
NHibernate.Driver.OracleDataClientDriver
</property>
<property name="connection.connection_string">
Data Source=localhost\sqlexpress;Persist Security Info=True;User ID=geoad;Password=xlns
</property>
<property name="show_sql">
true
</property>
<property name="proxyfactory.factory_class">
NHibernate.ByteCode.LinFu.ProxyFactoryFactory,NHibernate.ByteCode.LinFu
</property>
</session-factory>
</hibernate-configuration>
我错过了什么?我在 SQLServer 2008 R2 Express Edition 上运行 VisualStudio 2010 SP1,我认为驱动程序存在于机器上:从 VS2010 建立到服务器的新连接,它工作正常,并创建一个新的 webproject,使用 SQLServer 2008 上的数据集,使用相同的连接字符串,也可以正常工作。
怎么了?
最佳答案
您正在尝试将 MsSql2008Dialect
与 OracleDataClientDriver
一起使用。
你觉得有什么不对吗? :-)
使用正确的驱动程序,问题就会消失。
关于asp.net - NHibernate 问题 "Unable to find the requested .Net Framework Data Provider. It may not be installed. ",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6257309/