1

I am developing Windows application in asp.net with C# and Oracle as database. Here initially the application's some modules were made using entity framework, so am trying to replace the entity framework code to simply call stored procedure.

So I did that the application works fine on server but when application is run on client machine then it gives below error.

enter image description here

4
  • 1
    I guess you have googled the error message. Anything found so far? The first two hits are already stackoverflow questions with the same title. Commented Jul 26, 2016 at 12:13
  • @TimSchmelter Yes I search and just found that 3 ODAC's dll need to be added which I did but no luck so far. Commented Jul 26, 2016 at 12:17
  • 2
    You're loading 32 bit assemly into 64 bit application or vice versa. Commented Jul 26, 2016 at 12:22
  • @Husqvik I need to check this. Commented Jul 26, 2016 at 12:26

4 Answers 4

2

If nothing else works. Try this:

Project > properties > complie > check prefer 32 bit

This solved this for me.

Sign up to request clarification or add additional context in comments.

Comments

0

Few things to check, may be one of them works:

  • Try NuGet packages for ODP.net. You can find them here: https://www.nuget.org/packages/odp.net.managed/
  • I agree with @Husqvik, check that system is attempting to load the 64 bit Oracle DLL, and can't because the application is running in 32 bit mode. Try setting your application to explicitly be 64 Bit. Alternatively, install the 32 bit ODP.Net drivers and see if those work any better.

Hope this helps, please reply either way. Thanks

1 Comment

I tried to change application platform to 64 bit and run the application but with no luck and alternatively installed the 32 bit ODAC with application platform as 32 bit but still error do not change nor it fixed.
0
  • Uninstall Oracle.DataAccess
  • Uninstall Oracle.ManagedDataAccess
  • Uninstall Oracle.ManagedDataAccess.EntityFramework
  • Reinstall all these.

This worked for me.

Comments

0

C# instruction that caused the exception.

var connection = new OracleConnection(); // from Oracle.ManagedDataAccess.Client

Failed to initialize OracleConnection()

Setup
2 Projects

  1. Start Up (app.config)
  2. Includes Oracle (app.config)

Oracle connection parameters such as port, SID, connection name, user/pass and hostname are extracted from 'app.config'. The startup project has its own 'app.config'.

Problem
The Oracle connection string from 'app.config' is not getting extracted. There is no connection string. It's as if app.config does not exist.

Root Cause
The 'sectionGroup' element in startup project's App.config was deleted! As I've learned, without this element the corresponding 'sectionGroup' in app.config where Oracle is was ignored which also ignores connection string.

How or who deleted 'sectionGroup' element?
I have one user setting in startup projects' property that I removed. Since there's only one, Visual Studio deletes the entire 'userSettings' element in app.config. This is alright, no problem. However, Visual Studio also deleted the 'sectionGroup' element.

SOLUTION
Write back the 'sectionGroup' element.

Comments

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.