- 3,715,917 Users
- 2,242,907 Discussions
- 7,845,683 Comments
Forum Stats
Discussions
Categories
- 17 Data
- 362.2K Big Data Appliance
- 7 Data Science
- 1.6K Databases
- 474 General Database Discussions
- 3.7K Java and JavaScript in the Database
- 22 Multilingual Engine
- 487 MySQL Community Space
- 5 NoSQL Database
- 7.6K Oracle Database Express Edition (XE)
- 2.8K ORDS, SODA & JSON in the Database
- 417 SQLcl
- 42 SQL Developer Data Modeler
- 184.9K SQL & PL/SQL
- 21K SQL Developer
- 1.9K Development
- 3 Developer Projects
- 32 Programming Languages
- 135.1K Development Tools
- 9 DevOps
- 3K QA/Testing
- 256 Java
- 6 Java Learning Subscription
- 10 Database Connectivity
- 67 Java Community Process
- 1 Java 25
- 9 Java APIs
- 141.1K Java Development Tools
- 6 Java EE (Java Enterprise Edition)
- 153K Java Essentials
- 135 Java 8 Questions
- 86.2K Java Programming
- 270 Java Lambda MOOC
- 65.1K New To Java
- 1.7K Training / Learning / Certification
- 13.8K Java HotSpot Virtual Machine
- 10 Java SE
- 13.8K Java Security
- 3 Java User Groups
- 22 JavaScript - Nashorn
- 18 Programs
- 125 LiveLabs
- 30 Workshops
- 9 Software
- 3 Berkeley DB Family
- 3.5K JHeadstart
- 5.7K Other Languages
- 2.3K Chinese
- 3 Deutsche Oracle Community
- 11 Español
- 1.9K Japanese
- 2 Portuguese
The system cannot find the file specified. File name: 'System.Configuration.ConfigurationManager, Ve

Hi, i am trying to display data from a table in my database using ConsoleApp, but it would not be displayed instead I am shown with this message in the cmd prompt
The type initializer for 'OracleInternal.Common.ProviderConfig' threw an exception.
System.IO.FileNotFoundException: Could not load file or assembly 'System.Configuration.ConfigurationManager, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
File name: 'System.Configuration.ConfigurationManager, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
at OracleInternal.Common.ConfigBaseClass.GetInstance(Boolean bIsManaged)
at OracleInternal.Common.ProviderConfig..cctor()
System.Collections.ListDictionaryInternal
\VisualBasic\ConsoleApp1\bin\Debug\netcoreapp3.1\ConsoleApp1.exe (process 21988) exited with code 0.
To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
Press any key to close this window . . .
This is my code on my Console App;
using System;using System.Data;using Oracle.ManagedDataAccess.Client;using Oracle.ManagedDataAccess.Types;namespace HelloWorld{ class Class1 { [STAThread] static void Main(string[] args) { try { string conString = "User Id=test;Password=test123;" + "Data Source=localhost:1521//orcl;Pooling=fasle;"; OracleConnection con = new OracleConnection(); con.ConnectionString = conString; con.Open(); OracleCommand cmd = con.CreateCommand(); cmd.CommandText = "select first_name from persons"; OracleDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { Console.WriteLine("Person Name: " + reader.GetString(0)); } Console.WriteLine(); Console.WriteLine("Press 'Enter' to continue"); Console.ReadLine(); } catch (Exception ex) { Console.WriteLine(ex.Message); Console.WriteLine(ex.InnerException); Console.WriteLine(ex.Data); } //Console.WriteLine("Hello World!"); } }}
The code above exited with code 0, and I am able to view my table on my server explorer tab. Can someone help me out, cause I'm new to ODAC and .net
Thank you
Answers
-
I believe you need to add the System.Configuration.ConfigurationManager assembly to your app. You can get this from NuGet Gallery.
-
Unhandled exception. System.TypeLoadException: Could not load type 'System.Security.Principal.WindowsImpersonationContext' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
at OracleInternal.ConnectionPool.PoolManager`3.CreateNewPRThreadFunc(Object state)
at System.Threading.QueueUserWorkItemCallback.<>c.<.cctor>b__6_0(QueueUserWorkItemCallback quwi)
at System.Threading.ExecutionContext.RunForThreadPoolUnsafe[TState](ExecutionContext executionContext, Action`1 callback, TState& state)
at System.Threading.QueueUserWorkItemCallback.Execute()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
\VisualBasic\ConsoleApp1\bin\Debug\netcoreapp3.1\ConsoleApp1.exe (process 15552) exited with code 0.
To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
Press any key to close this window . . .
I am thrown with this error instead. I tried searching for this assembly but I can't find it in the NuGet gallery.
-
I think you may be using managed ODP.NET (for .NET Framework) instead of ODP.NET Core (for .NET Core) in your app. Did you load Oracle.ManagedDataAccess (managed ODP.NET) or Oracle.ManagedDataAccess.Core (ODP.NET Core) from NuGet Gallery? If it's the former, then remove it and download the latter.