Solved

System.InvalidOperationException

Posted on 2010-09-13
3
736 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
Comment Utility
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
Comment Utility
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
Comment Utility
i have windows seven of 64 bits
cmd.jpg
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

763 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

11 Experts available now in Live!

Get 1:1 Help Now