C#使用MongodbDriver2.4.4连接数据库的问题

报如下错误,使用的System.Runtime.InteropServices.RuntimeInformation.dll是4.0.0版本
500 未能加载文件或程序集“System.Runtime.InteropServices.RuntimeInformation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040)

System.IO.FileLoadException: 未能加载文件或程序集“System.Runtime.InteropServices.RuntimeInformation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040)
文件名:“System.Runtime.InteropServices.RuntimeInformation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”
在 MongoDB.Driver.Core.Connections.ClientDocumentHelper.CreateOSDocument()
在 System.Lazy`1.CreateValue()
--- 引发异常的上一位置中堆栈跟踪的末尾 ---
在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
在 System.Lazy`1.get_Value()
在 MongoDB.Driver.Core.Connections.ClientDocumentHelper.CreateClientDocument(String applicationName)
在 MongoDB.Driver.Core.Connections.BinaryConnectionFactory..ctor(ConnectionSettings settings, IStreamFactory streamFactory, IEventSubscriber eventSubscriber)
在 MongoDB.Driver.Core.Configuration.ClusterBuilder.BuildCluster()
在 MongoDB.Driver.ClusterRegistry.CreateCluster(ClusterKey clusterKey)
在 MongoDB.Driver.ClusterRegistry.GetOrCreateCluster(ClusterKey clusterKey)
在 MongoDB.Driver.MongoClient..ctor(MongoClientSettings settings)
在 ZKWeb.ORM.MongoDB.MongoDBEntityMappings..ctor(MongoUrl connectionUrl, IEnumerable1 handlers, IEnumerable1 providers)
在 ZKWeb.ORM.MongoDB.MongoDBDatabaseContextFactory..ctor(String database, String connectionString, IEnumerable1 handlers, IEnumerable1 providers)

警告: 程序集绑定日志记录被关闭。
要启用程序集绑定失败日志记录,请将注册表值 [HKLMSoftwareMicrosoftFusion!EnableLog] (DWORD)设置为 1。
注意: 会有一些与程序集绑定失败日志记录关联的性能损失。
要关闭此功能,请移除注册表值 [HKLMSoftwareMicrosoftFusion!EnableLog]。

阅读 5.9k
1 个回答
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进