.netcore 3.1 升级 .net5 :The type initializer for 'OracleInternal.ServiceObjects.OracleConnectionImpl' threw an exception.

1、将.csproj文件

<TargetFramework>net5.0</TargetFramework>

2、连接oracle,open时报错:The type initializer for 'OracleInternal.ServiceObjects.OracleConnectionImpl' threw an exception.

需要在.csproj文件添加:<EnableUnsafeBinaryFormatterSerialization>true</EnableUnsafeBinaryFormatterSerialization>

作者: Cody

出处: https://www.cnblogs.com/hwxing/

本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出, 原文链接

原文地址:https://www.cnblogs.com/hwxing/p/14297955.html