NHibernate Oracle-无法加载DLL'OraOps10w.dll' [英] NHibernate Oracle - Unable to load DLL 'OraOps10w.dll'

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

问题描述

这是我第一次使用nHibernate(也从未使用过hibernate),而我正在尝试使用oracle数据库.我的项目是MVC3 Web应用程序VS20010.所以,这是我的配置文件:

It's my first time using nHibernate (also never used hibernate), and i'm trying to do it with an oracle db. My project is a MVC3 Web Application, VS20010. So, here is my config file:

<?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> 

以下是我如何建立会话(从nhibernate forge复制)

The following is how i build the session (copied from nhibernate forge)

private static ISessionFactory SessionFactory
        {
            get
            {
                if (_sessionFactory == null)
                {
                    var configuration = new Configuration();
                    configuration.Configure();
                    configuration.AddAssembly(typeof(Categoria).Assembly);
                    _sessionFactory = configuration.BuildSessionFactory();
                }
                return _sessionFactory;
            }
        }

我当前的错误消息是:

无法加载DLL'OraOps10w.dll':找不到指定的模块. (来自HRESULT的异常:0x8007007E),位于_sessionFactory = configuration.BuildSessionFactory();

Unable to load DLL 'OraOps10w.dll': Couldn't find specified module. (Exception from HRESULT: 0x8007007E), at _sessionFactory = configuration.BuildSessionFactory();

在此之前,我遇到了一些问题,这使我不得不:

I've faced a few problems before this one, wich led me to:

  • 添加Oracle.DataAccess.dll的引用
  • 在web.config上添加一个DbproviderFactories标记.如下所示:(由于某种原因无法在此处粘贴所有代码)

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" 

推荐答案

Oracle数据提供程序需要很多dll:

The Oracle Data Provider needs quite a few dlls:

通过ODAC软件包:

  • Oracle.DataAccess.dll(这是整个列表中唯一的.NET程序集)
  • OraOps11w.dll

从Instantclient-basiclite软件包中:

From the instantclient-basiclite package:

  • oci.dll
  • ociw32.dll
  • orannzsbb11.dll
  • oraocci11.dll
  • oraociicus11.dll

由于只能将Oracle.DataAccess.dll添加为.NET引用,因此需要其他方法来确保所有其他dll也都位于.exe目录中.

Since you can only add the Oracle.DataAccess.dll as a .NET reference you need some other way to make sure that all other dlls are in the .exe directory too.

据我所知,即时客户端还有一个安装程序,因此您不需要.exe目录中的那些dll,但随后您必须确保所有客户端都已安装了这些文件.

As far as I know there is also an installer for the instant client so that you don't need those dlls in you .exe directory, but then you have to make sure that all clients have that installed.

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

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