3

Following this tutorial, Introduction to Building ODP.NET, Managed Driver Applications

In the topic "Connect using the TNS_ADMIN Property", when I run I get "Unrecognized configuration section oracle.manageddataaccess.client" error.

1 Answers1

5

I ran into this issue myself in a multi-project solution including a Website. In my case, I have a "Data" project responsible for all Database interaction. It is in THIS project's App.config file that I needed to put my Oracle settings. In fact, the file was already prepared for me with the proper configSections to handle it.

Either way, this is how my App.config file looks now. Either add the missing configSections to your config file, or - if you have multiple projects - ensure you add the settings to the correct project's App.config file.

Your version numbers and PublicKeyTokens may vary.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <section name="oracle.manageddataaccess.client"
      type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.122.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342"/>
  </configSections>
  <system.data>
    <DbProviderFactories>
      <remove invariant="Oracle.ManagedDataAccess.Client"/>
      <add name="ODP.NET, Managed Driver" invariant="Oracle.ManagedDataAccess.Client" description="Oracle Data Provider for .NET, Managed Driver"
        type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.122.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342"/>
    </DbProviderFactories>
  </system.data>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <publisherPolicy apply="no"/>
        <assemblyIdentity name="Oracle.ManagedDataAccess" publicKeyToken="89b483f429c47342" culture="neutral"/>
        <bindingRedirect oldVersion="4.121.0.0 - 4.65535.65535.65535" newVersion="4.122.1.0"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <oracle.manageddataaccess.client>
    <version number="*">
      <settings>
        <setting name="TNS_ADMIN" value="C:\Oracle\product\11.2.0\client_1\network\admin\" />
      </settings>
    </version>
  </oracle.manageddataaccess.client>
</configuration>
Andrew S
  • 531
  • 1
  • 4
  • 15