C# NHibernate Oracle-无法加载DLL“OraOps10w.DLL”
这是我第一次使用nHibernate,也从来没有使用过hibernate,我正在尝试使用oracle数据库。我的项目是一个MVC3 Web应用程序VS20010。下面是我的配置文件:C# NHibernate Oracle-无法加载DLL“OraOps10w.DLL”,c#,asp.net-mvc,oracle,nhibernate,C#,Asp.net Mvc,Oracle,Nhibernate,这是我第一次使用nHibernate,也从来没有使用过hibernate,我正在尝试使用oracle数据库。我的项目是一个MVC3 Web应用程序VS20010。下面是我的配置文件: <?xml version="1.0" encoding="utf-8" ?> <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2"> <session-factory> <prope
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="dialect">NHibernate.Dialect.Oracle10gDialect</property>
<property name="connection.driver_class">NHibernate.Driver.OracleDataClientDriver</property>
<property name="connection.connection_string">Data Source=srcname;User ID=myuser;Password=****;Unicode=True</property>
<property name="show_sql">true</property>
</session-factory>
</hibernate-configuration>
我当前的错误消息是:
无法加载DLL“OraOps10w.DLL”:找不到指定的模块。HRESULT异常:0x8007007E,位于_sessionFactory=configuration.BuildSessionFactory
在此之前,我遇到了一些问题,这让我想到:
添加对Oracle.DataAccess.dll的引用
在web.config上添加DBProviderFactorys标记。如下所示:由于某些原因,无法将所有代码粘贴到此处
Oracle数据提供程序需要很多DLL: 从ODAC包: Oracle.DataAccess.dll这是整个列表中唯一的.NET程序集 OraOps11w.dll 从instantclient basiclite包: oci.dll ociw32.dll orannzsb11.dll Oracioc11.dll oraociicus11.dll 由于只能将Oracle.DataAccess.dll添加为.NET引用,因此需要其他方法来确保所有其他dll也位于.exe目录中 据我所知,还有一个即时客户端的安装程序,这样你就不需要在你的.exe目录中安装那些DLL,但是你必须确保所有客户端都安装了
private static ISessionFactory SessionFactory
{
get
{
if (_sessionFactory == null)
{
var configuration = new Configuration();
configuration.Configure();
configuration.AddAssembly(typeof(Categoria).Assembly);
_sessionFactory = configuration.BuildSessionFactory();
}
return _sessionFactory;
}
}
add name="Oracle Data Provider for .NET"
invariant="Oracle.DataAccess.Client"
description="Oracle Data Provider for .NET"
type="Oracle.DataAccess.Client.OracleClientFactory,
Oracle.DataAccess,
Version=2.111.6.20,
Culture=neutral,
PublicKeyToken=89b483f429c47342"