Oracle ODP.NET error

dawriter picture dawriter · Oct 24, 2015 · Viewed 18.5k times · Source

I have a VS 2012 Web Project Up. I have ODP.NET installed as we are an Oracle Workshop. I inherited a project that uses Oracle.ManagedAccess.Data and EF.

Upon running the project in VS 2012, I get the following error:

There is a duplicate 'oracle.manageddataaccess.client' section defined..

The solution was to disable the following line in web.config

<!--<section name="oracle.manageddataaccess.client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />-->

Which was fine. The project compiled but upon executing a simple command such as getting a password back where it has to read the database another error was tripped up:

System.Data.ConstraintException: Column 'InvariantName' is constrained to be unique.  Value 'Oracle.ManagedDataAccess.Client' is already present.

Now I'm aware that the error is tripped up by ODP.NET and having it exist in the GAC thus the double error reporting.

Is there another line I should be commenting out or is there a way to disable ODP.NET briefly? I don't want to install that client as I use it for other projects.

thanks

Answer

Alex R. picture Alex R. · Dec 17, 2015

I found the following on the Oracle site regarding the "There is a duplicate 'oracle.manageddataaccess.client' section defined.":

If your application is a web application and the above entry was added to a web.config and the same config section handler for "oracle.manageddataaccess.client" also exists in machine.config but the "Version" attribute values are different, an error message of "There is a duplicate 'oracle.manageddataaccess.client' section defined." may be observed at runtime. If so, the config section handler entry in the machine.config for "oracle.manageddataaccess.client" has to be removed from the machine.config for the web application to not encounter this error. But given that there may be other applications on the machine that depended on this entry in the machine.config, this config section handler entry may need to be moved to all of the application's .NET config file on that machine that depend on it.

I hope it helps.