1

Good morning, my application uses oracle.manageddataaccess.client, when installing oracle.managedDataAccess via Nuget, a reference was created in my web.config as below:

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

For my application to run, I need the identical section in the machine.config file. (Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ Config \ machine.config), machine.config file below:

config machine.config

The problem is that whenever I need to run another application with a different version of oracle, the error occurs with duplicate key, because in web.config a version is configured, and in machine.config, the section is configured with another version. It is always necessary to manually edit the file machine.config and setting the version according to the version of web.config.

What I tried to accomplish to solve the problem was:

  • add allowOverride="true" in web.config section (Unrecognized Attribute)
  • Add a <clear /> element in section (no success)

I found that on other machines where it is not necessary to put the manual version, machine.config uses the section oracle.dataaccess.client, so I researched is due to using the unmanaged odp.net driver, changing my section for this too did not work.

Would there be any way to override this section? Or use oracle.dataaccess.client to resolve this issue.

André Luiz
  • 307
  • 5
  • 11
  • Did you try `Version=4.122.*.*` – Wernfried Domscheit Oct 10 '19 at 14:19
  • Did you put `Oracle.ManagedDataAccess.dll` into the GAC? Usually the Policies control which version is loaded. Check with `gacutil /l Policy.4.122.Oracle.ManagedDataAccess` – Wernfried Domscheit Oct 10 '19 at 14:22
  • @WernfriedDomscheit yes, i receive: There is a duplicate 'oracle.manageddataaccess.client' section defined – André Luiz Oct 10 '19 at 14:24
  • @WernfriedDomscheit I believe it could be this problem, I took my machine with oracle already installed, found scripts adding a dll into the GAC. However, with the command you sent me it didn't bring any results, and searching for GAC -l didn't find it either. – André Luiz Oct 10 '19 at 14:34
  • in the .bat I found has the following scripts: OraProvCfg /action:config /product:odpm /frameworkversion:v4.0.30319 /providerpath:"%~dp0..\common\Oracle.ManagedDataAccess.dll" /set:settings\TNS_ADMIN:"%~dp0..\..\..\network\admin" OraProvCfg /action:register /product:odpm /component:perfcounter /providerpath:"%~dp0..\common\Oracle.ManagedDataAccess.dll" OraProvCfg /action:gac /providerpath:"%~dp0..\common\Oracle.ManagedDataAccess.dll" – André Luiz Oct 10 '19 at 14:36
  • Then add it to the GAC. Perhaps modify the path in .bat to absolute folder names. – Wernfried Domscheit Oct 10 '19 at 16:06
  • I agree with Andre--we would like to override the version in the machine.config, not remove it from machine.config. – Patrick Szalapski Nov 21 '19 at 14:59

1 Answers1

3

I got it to work by using the following in web.config:

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

And later use the new config section:

  <new.oracle.manageddataaccess.client>
    <version number="*">
           <!--Oracle configuration settings-->
    </version>
  </new.oracle.manageddataaccess.client>
MogalManic
  • 46
  • 3