?
Solved

System.InvalidOperationException

Posted on 2010-09-13
3
Medium Priority
?
756 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 11

Accepted Solution

by:
lenordiste earned 1000 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Here I am going to explain creating proxies at runtime for WCF Service. So basically we use to generate proxies using Add Service Reference and then giving the Url of the WCF service then generate proxy files at client side. Ok, what if something ge…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

765 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