Problem to use 'Oracle.ManagedDataAccess' .dll with my ASP.NET Core

2.7k Views Asked by At

I started in the development of a RESTful web service with asp.net core.

I use a home framework for oracle database access, this home framework is used in all my projects but this one uses the Oracle.ManagedDataAccess dll.

When I want to use a method from a framework .dll to get some data from my database I get the error: System.TypeLoadException: 'Could not load type' System.Security.Principal.WindowsImpersonationContext 'from assembly mscorlib, Version = 4.0.0.0, Culture = neutral, PublicKeyToken = b77a5c561934e089 '.'

Is there a solution ?

I am new to asp.net CORE, if I do the same thing with an ASP.NET Web API service, it works.

I tried with the NuGets to install Oracle.managedDataAccess but I have the same problem

I also tried with Oracle.ManagedDataAccess.Core ==> System.IO.FileLoadException: Could not load file or assembly 'Oracle.ManagedDataAccess

I find it a shame that I can not use my .dll files Do you have a solution to offer me?

Thanks in advance

 string _connStr = "Data Source = " + Connector.tnsName + "; User ID = " + Connector.user + "; Password = " + Connector.password + "; Min Pool Size=10;Connection Lifetime=120;Connection Timeout=60;Incr Pool Size=5; Decr Pool Size=2";
        mConn = new OracleConnection(_connStr);
        if (OpenConnection)
        {
            try
            {
                mConn.Open(); ==>Could not load type' System.Security.Principal.WindowsImpersonationContext
1

There are 1 best solutions below

1
On

You can try Oracle.ManagedDataAccess.Core only , if you install both , you may meet the errors .

Reference : Connect to Oracle database in dotnet mvc application

Here is the code sample : Getting Started with ODP.NET Core