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

Taha Sözgen 10 Reputation points
2023-02-03T07:24:19.1066667+00:00

Hi There;

I have an ASP.NET MVC Application. Its version is .NET 4.5.2. It is facilitating Entity Framework and it is using Oracle Database 19c. I have found a bug in the application and I solve it. It runs smoothly on my local computer. Whenever I publish the application to an IIS server, I have got the error message below:

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

This is the content of the web config (1).xml.

Failed Request Tracing option is opened in IIS, and it does not report any problem.

Diagnosis of chatGPT is as follows:

This error message indicates that there are multiple instances of the same assembly reference in the application's configuration file, typically the web.config file. To resolve the issue, you need to remove the duplicate references to the assembly oracle.manageddataaccess.client. You can open the web.config file and remove the duplicate references, keeping only one instance. Make sure to save the changes and then republish the application to the IIS server. If you have multiple projects in your solution and are using a shared library, you may have referenced the library in multiple projects, causing duplicates in the final web.config file. To resolve this, you can either remove the references from all but one project, or create a binding redirect in the web.config file to direct multiple versions of the assembly to a single version.

I have inspected many solution candidates, and the findings also changed when I changed the publishing of the software. When I asked my findings to chatGPT, I got the following answers:

i. Incorrect IIS configuration: Ensure that the IIS website and application pool are set up correctly.
ii. Missing dependencies: Make sure that all necessary .NET Framework versions and
libraries are installed on the server.
iii. Incorrect application pool identity: Set the application pool identity to a low-privilege user account.
vi. Permissions issues: Ensure that the ASP.NET process identity has permission to access the application's files and directories.
v. Incorrect web.config settings: Check the web.config file for any incorrect settings, such as incorrect database connection strings.
vii. Application code errors: Check the event logs or enable failed request tracing to see if there is any information about the specific error.

To resolve the issue, you can try the following steps: i. Check the IIS logs for more information about the error.
ii. Enable Failed Request Tracing to get more detailed information about the error.
iii. Compare the server's configuration with a working development environment to identify any differences.
iv. Try re-deploying the application with a clean solution and clean build.
If the issue persists, it may be helpful to consult the Microsoft ASP.NET MVC documentation or seek assistance from a qualified developer or consultant.

I have inspected the issue through the website and I found some proposals.

1- I renamed oracle.manageddataaccess.client to new.oracle.manageddataaccess.client. (How to replace the "oracle.manageddataaccess.client" section of machine.config with web.config section) In this circumstance, my new web.config file is as follows.

In this circumstance, I am getting the error below:

" Server Error in '/' Application. _ Runtime Error Description: An exception occurred while processing your request. Additionally, another exception occurred while executing the custom error page for the first exception. The request has been terminated. "

This is the content of the failed http request trace: fr000006 (1).xml

2- I run the codes in powershell as described here: oracle.manageddataaccess.client duplicate entry for ASP:NET

set Oracle_x64=c:\oracle\product\12.1\Client_x64\odp.net set Oracle_x86=c:\oracle\product\12.1\Client_x86\odp.net set OraProvCfg_x64=%Oracle_x64%\bin\4\OraProvCfg set OraProvCfg_x86=%Oracle_x86%\bin\4\OraProvCfg "OraProvCfg_x64" /action:config /force /product:odpm /frameworkversion:v4.0.30319 /productversion:4.121.1.0 /unset:settings\TNS_ADMIN "OraProvCfg_x64" /action:config /force /product:odpm /frameworkversion:v4.0.30319 /productversion:4.121.2.0 /unset:settings\TNS_ADMIN "OraProvCfg_x64" /action:config /force /product:odpm /frameworkversion:v4.0.30319 /productversion:4.122.1.0 /unset:settings\TNS_ADMIN "OraProvCfg_x64" /action:config /force /product:odpm /frameworkversion:v4.0.30319 /productversion:4.122.18.3 /unset:settings\TNS_ADMIN "OraProvCfg_x64" /action:unconfig /product:odpm /frameworkversion:v4.0.30319 /productversion:4.121.1.0 "OraProvCfg_x64" /action:unconfig /product:odpm /frameworkversion:v4.0.30319 /productversion:4.121.2.0 "OraProvCfg_x64" /action:unconfig /product:odpm /frameworkversion:v4.0.30319 /productversion:4.122.1.0 "OraProvCfg_x64" /action:unconfig /product:odpm /frameworkversion:v4.0.30319 /productversion:4.122.18.3 "OraProvCfg_x86" /action:config /force /product:odpm /frameworkversion:v4.0.30319 /productversion:4.121.1.0 /unset:settings\TNS_ADMIN "OraProvCfg_x86" /action:config /force /product:odpm /frameworkversion:v4.0.30319 /productversion:4.121.2.0 /unset:settings\TNS_ADMIN "OraProvCfg_x86" /action:config /force /product:odpm /frameworkversion:v4.0.30319 /productversion:4.122.1.0 /unset:settings\TNS_ADMIN "OraProvCfg_x86" /action:config /force /product:odpm /frameworkversion:v4.0.30319 /productversion:4.122.18.3 /unset:settings\TNS_ADMIN "OraProvCfg_x86" /action:unconfig /product:odpm /frameworkversion:v4.0.30319 /productversion:4.121.1.0 "OraProvCfg_x86" /action:unconfig /product:odpm /frameworkversion:v4.0.30319 /productversion:4.121.2.0 "OraProvCfg_x86" /action:unconfig /product:odpm /frameworkversion:v4.0.30319 /productversion:4.122.1.0 "OraProvCfg_x86" /action:unconfig /product:odpm /frameworkversion:v4.0.30319 /productversion:4.122.18.3

It has no avail.

3- The problem may be due to name conflict between machine.config and web.config. Technical description of the situation is as follows: (Oracle ODP.NET error)

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.

So I deleted the oracle.manageddataaccess.client from the web.config file, but the problem persists. I deleted the oracle.manageddataaccess.client from the machine.config file from the IIS server, the IIS server didn’t work.

How can I solve the problem? Any other suggestions? Thanks in advance.

Internet Information Services
.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,346 questions
ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,246 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Taha Sözgen 10 Reputation points
    2023-02-08T07:20:55.93+00:00

    The problem has been solved by creating a freshly installed operating system and IIS server. Previously, IIS has populated from a real server. I suspect that the problem originates because of this, when I create a freshly installed operating system and IIS server and publish there, the problem has solved.