Solved

System.InvalidOperationException

Posted on 2010-09-13
3
742 Views
Last Modified: 2012-05-10
Hi experts, I developed a web service that connects to an oracle database and I have the following error:
System.InvalidOperationException: Attempting to load the Oracle client libraries threw BadImageFormatException. This problem will occur when running 64-bit mode with the client component 32-bit Oracle installed. ---> System.BadImageFormatException: Attempt to load a program with an incorrect format. (Exception from HRESULT: 0x8007000b)
   en System.Data.Common.UnsafeNativeMethods.OCILobCopy2(IntPtr svchp, IntPtr errhp, IntPtr dst_locp, IntPtr src_locp, UInt64 amount, UInt64 dst_offset, UInt64 src_offset)
   en System.Data.OracleClient.OCI.DetermineClientVersion()
   --- Fin del seguimiento de la pila de la excepción interna ---
   en wsConsultarInscripciones.consultar.MostrarCursosHabilitadosPAP() en C:\Users\elopez\Documents\AMAG\slnWSExcelInscritos\wsConsultarInscripciones\consultar.asmx.cs:línea 48

My machine is windows seven of 64 bits.
I executed the project in 32 bit and 64-bit and I have the same error. Attached Image

This is my code:
[WebMethod]
        public DataSet MostrarCursosHabilitadosPAP()
        {
            OracleConnection con;
            OracleCommand cmd;
            OracleDataAdapter adpt;
            DataSet ds = new DataSet();
            string SP = "pckCurso.upCursosHabilitadosPAPws";
            con = new OracleConnection(ConfigurationManager.ConnectionStrings["OracleDesa"].ConnectionString);

            try
            {
                cmd = new OracleCommand(SP, con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("pCursor", OracleType.Cursor).Direction = ParameterDirection.Output;
                adpt = new OracleDataAdapter(cmd);
                con.Open();
                adpt.Fill(ds);
                con.Close();
                return ds;
            }
            catch (Exception ex)
            {
               
                throw ex;
            }
           
        }
compilacion.jpg
0
Comment
Question by:enrique_aeo
  • 2
3 Comments
 
LVL 11

Accepted Solution

by:
lenordiste earned 250 total points
ID: 33667587
you have two options here:

1) you set your application pool to run in 32 bit mode. Assuming you are using IIS 6.0:
http://www.microsoft.com/technet/prodtechnol/windowsserver2003/library/iis/405f5bb5-87a3-43d2-8138-54b75db73aa1.mspx

2) you install the 64bit versions of your oracle client components
0
 
LVL 11

Expert Comment

by:lenordiste
ID: 33667602
also look at this nice article since you might be confused about what it means to target an application for x32 or x64:
http://visualstudiohacks.com/articles/visual-studio-net-platform-target-explained/
0
 

Author Comment

by:enrique_aeo
ID: 33667852
i have windows seven of 64 bits
cmd.jpg
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now