我有一个基于 .net framework 4.5.1 的 Web 项目,我们正在尝试为该项目添加 PostgreSQL 支持。使用 Nuget,我已经将 4.0.4 npgsql 安装到了该项目中,在引用中,我看到以下内容被添加到了项目中:
- Npgsql - 4.0.4.0 - 运行时版本 v4.0.30319
- System.Threading.Tasks.Extensions - 4.2.0.0 - 运行时版本 v4.0.30319
当我尝试运行该项目并连接数据库以获取数据时,我收到了以下错误提示:“FileNotFoundException”。
System.TypeInitializationException
HResult=0x80131534
Message=The type initializer for 'com.rsol.RConfig' threw an exception.
Source=RConfig
StackTrace:
at com.rsol.RConfig.getInstance() in C:\Workspaces\PS\RConfig\RConfig.cs:line 1113
at RAdmin.Global.Application_Start(Object sender, EventArgs e) in C:\Workspaces\PS\RAdmin\Global.asax.cs:line 528
Inner Exception 1:
TypeInitializationException: The type initializer for 'com.rsol.Db.DbMgr' threw an exception.
Inner Exception 2:
FileNotFoundException: Could not load file or assembly 'System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
Inner Exception 3:
FileNotFoundException: Could not load file or assembly 'System.Threading.Tasks.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
使用Nuget安装的System.Threading.Tasks.Extensions未能加载到项目中。当我检查System.Threading.Tasks.Extensions引用的属性时,dll文件存在于该位置。我还尝试使用gacutil将System.Threading.Tasks.Extensions.dll文件安装到程序集中。但是我仍然遇到相同的错误。
如果您需要任何其他信息,请告诉我。
真的很感谢任何帮助。