Avatar of enrique_aeo
enrique_aeo
 asked on

System.InvalidOperationException

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
WCFASP.NETC#

Avatar of undefined
Last Comment
enrique_aeo

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
lenordiste

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
lenordiste

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/
enrique_aeo

ASKER
i have windows seven of 64 bits
cmd.jpg
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck