0

I have a RESTful Api that inserts,deletes,updates and gets data from Oracle database. I have installed Oracle on my pc.
The app cracked continously, saying that Could not load file or assembly 'Oracle.DataAccess.I changed the Target platform of my project to x86 and it worked.
I am using a Chrome extension called Restlet Client to verify data that i am getting. If I am not using Oracle objects at all, it works and it gives me status ok.

 public IEnumerable<string> Get()
    {
        return new string[] { "1", "2" };

    }

enter image description here

If I am using Oracle object to connect to database like this

      public IEnumerable<string> Get()
        {
                DataSet ds;
                using (OracleConnection conn = new OracleConnection(ConfigurationManager.ConnectionStrings["Licenta"].ConnectionString))
                {
                  OracleDataAdapter adapter = new OracleDataAdapter(selectUsers,conn);
                  ds = new DataSet();
                   adapter.Fill(ds);

                }

            return new string[] { "1", "2" };
}

I am getting this error. enter image description here

Do you know why ?
I also tried with a dummy website and I have the same problem.

6
  • If your web host is running in 64-bit mode, then it won't be able to load the x86 assembly. You need to have your web API compiled for x64, including a reference to a 64-bit version of Oracle.DataAccess.dll. Commented May 5, 2017 at 14:19
  • There are so many duplicates of this question on here stackoverflow.com/questions/15293975/… Commented May 5, 2017 at 14:20
  • If your program is x64 then you should use oracle libs for x64, and if they are not available, then change your program. The reason why you're not getting an error if not using any oracle objects at all is because the compiler will not try to load an assembly if there are no usages of it Commented May 5, 2017 at 14:27
  • @Mangist I think those are old Commented May 5, 2017 at 14:27
  • I remember that there was an issue when the only driver available was x86, but that was in the past. You can look at ODAC downloads or check ODP.NET on Nuget. Commented May 5, 2017 at 14:36

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.