简体   繁体   中英

How to replace the “oracle.manageddataaccess.client” section of machine.config with web.config section

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:

配置 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.

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM