我有一个基于.net框架4.5.1的web项目。我们正试图为该项目添加PostgreSQL支持。使用Nuget,我已经在项目中安装了4.0.4npgsql。在参考资料中,我看到以下内容正在添加到项目中。
当我尝试运行该项目并连接并从数据库获取数据时,我会收到以下错误: 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文件安装到程序集。我还是会犯同样的错误。
如果您需要更多的信息,请告诉我。
任何帮助都是非常感谢的。
发布于 2022-05-05 14:15:32
我一直在和bindingRedirect做斗争。我终于找到了一个真正解决问题的方法。
我在.net 4.8中有一个WCF服务器项目,这取决于.net标准2.0中的项目。
我正在更新推荐项目中的Nuget包。我有各种各样的问题,我不想在这里提。
我有bindingRedirects在web.config。我不得不重新发现,这些都是不必要的,甚至是相互冲突的,因为这些是自动生成到dll.config的。在其他地方可以看到,要使这一工作发挥作用有各种方面。
但对我来说真正的问题是,对于IIS来说,我必须将web.config链接到dll.config。后者是一个完整的配置文件,包含所有的bindingRedirects,这最终是可以工作的。
https://stackoverflow.com/questions/59156537
复制相似问题