简体   繁体   English

使用32位Oracle Service在64位模式下运行

[英]Running in 64 bit mode with the 32 bit Oracle Service

This question similar to link 这个问题类似于链接

link2 链接2

I fixed this problem, but when I opened new project Wcf service library , I had that same problem, and all this changes that I had done before did't help me. 我解决了这个问题,但是当我打开新的项目Wcf服务库时 ,我遇到了同样的问题,以前所做的所有更改都无济于事。

I tried every thing that I did before and even more but it didn't helped. 我尝试了以前做过的每件事,甚至更多,但没有帮助。

It is important to say that if I do the same in another project all work fine but in WcfServiceLibrary it doesn't work.In WcfServiceApplication it working too. 重要的是要说如果我在另一个项目中也能正常工作,但在WcfServiceLibrary中则无法正常工作,在WcfServiceApplication中它也可以正常工作。

I use VS2012(4.5) Win7 (64), my Oracle clien 32, but in other project this is not a problem. 我使用VS2012(4.5)Win7(64),我的Oracle clien 32,但是在其他项目中这不是问题。

Maybe it because Wcf library project i don't know. 也许是因为我不知道Wcf库项目。 i just buil service that save datd from database and i get error on connection to db. 我只是建立了从数据库保存datd的服务,并且在连接到数据库时出现错误。

Error: Attempt to load Oracle client libraries threw BadImageFormatException. This problem will occur when running in 64 bit mode with the 32 bit Oracle client components installed.

My code 我的密码

using (OracleConnection con = new OracleConnection())
{
    con.ConnectionString = "User Id=zxc;Password=zxc;Data Source=NXE";
    con.Open();//here i get error
    OracleCommand cmd = new OracleCommand();
    cmd.Connection = con;
    cmd.CommandText = "select * from " + Table;
    int rowsUpdated = cmd.ExecuteNonQuery();
    OracleDataReader reader = cmd.ExecuteReader();
    String DataFromORL = "";
    int row = 0;
    while (reader.Read() && row < 50)
    {
        row++;
        if (reader.HasRows)
        {
            DataFromORL += reader.GetInt32(0);
        }
    }
}

I too got the same issue. 我也有同样的问题。 for me issue got fixed by doing the following thing. 对我来说,通过执行以下操作可以解决问题。 prior to this check whether you have installed both 32bit and 64bit Oracle clients to make it available in both environments. 在此之前,请检查您是否同时安装了32位和64位Oracle客户端以使其在两种环境中均可用。

for me the reason for getting this error. 对我来说,得到此错误的原因。

Error: Attempt to load Oracle client libraries threw BadImageFormatException. 错误:尝试加载Oracle客户端库时抛出BadImageFormatException。 This problem will occur when running in 64-bit mode with the 32-bit Oracle client components installed. 在安装了32位Oracle客户端组件的64位模式下运行时,将发生此问题。

is because of the environmental variables has only one installation location and it is 32bit installation location that's why the error is This problem will occur when running in 64-bit mode with the 32-bit Oracle client components installed. 是因为环境变量只有一个安装位置,而32位安装位置才是错误的原因。在安装了32位Oracle客户端组件的64位模式下运行时,将发生此问题。

so, to resolve this what I did is, I added 64-bit installation location also and restarted my visual studio. 因此,要解决此问题,我还添加了64位安装位置,然后重新启动了Visual Studio。 if it does not work try by restarting system also, we are supposed to add both bin directories available in Oracle client installation location that we specify while installing Oracle clients. 如果不起作用,请尝试重新启动系统,我们应该在安装Oracle客户端时指定的Oracle客户端安装位置中添加两个bin目录。

In my system location is like: 在我的系统中的位置是这样的:

32-bit C:\\app\\client\\<user>\\product\\12.1.0\\client_2\\bin
64-bit C:\\app\\client\\<user>\\product\\12.1.0\\client_1\\bin

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM