FileNotFoundException:无法加载文件或程序集“System.Configuration.ConfigurationManager,

2024-03-10

我正在尝试使用 ado.net 从 .net core 3.1 连接到 oracle 数据库,这是我的代码

private OracleConnection GetOracleConnection()
{
            string conString = "Data Source=Q550.adr.XXXX.com;Persist Security,Info=True;User ID=XXXX;Password=CCC39";
            OracleConnection con = new OracleConnection(conString);
            return con;
}

但是当这个函数执行时,第 2 行发生了以下异常

System.TypeInitializationException:“‘OracleInternal.Common.ProviderConfig’的类型初始值设定项引发异常

FileNotFoundException:无法加载文件或程序集“System.Configuration.ConfigurationManager, 版本=4.0.2.0,文化=中性,PublicKeyToken=cc7b13ffcd2ddd51'。该系统找不到指定的文件。 **

谁能告诉我发生了什么事?


您可以从 Nuget 安装 System.Configuration.ConfigurationManager

Install-Package System.Configuration.ConfigurationManager

这个问题是一个已知问题,您可以在此处看到,推荐的解决方案是 nuget package

https://github.com/pusher/pusher-websocket-dotnet/issues/34 https://github.com/pusher/pusher-websocket-dotnet/issues/34

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

FileNotFoundException:无法加载文件或程序集“System.Configuration.ConfigurationManager, 的相关文章

随机推荐