MongoDB客户端在mscorlib中抛出FileNotFoundException [英] MongoDB client throws a FileNotFoundException in mscorlib

查看:115
本文介绍了MongoDB客户端在mscorlib中抛出FileNotFoundException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Visual Studio .NET 4.6和 Robomongo 连接到我的数据库没有问题

I'm using Visual Studio .NET 4.6 and Robomongo has no problem connecting to my database

我对 MongoDB

using MongoDB.Driver;
using MongoDB.Driver.Builders;
using MongoDB.Bson;

正在执行的代码:

MongoClient client = new MongoClient("mongodb://localhost");
MongoServer server = client.GetServer();
MongoDatabase mongoDatabase = server.GetDatabase("GameCollection");

完整的错误消息:

"System.IO.FileNotFoundException"类型的未处理异常 发生在mscorlib.dll

An unhandled exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll

其他信息:无法加载文件或程序集 'System.Runtime.InteropServices.RuntimeInformation,版本= 4.0.0.0, 文化=中性,PublicKeyToken = b03f5f7f11d50a3a'或其中之一 依赖关系.系统找不到指定的文件.

Additional information: Could not load file or assembly 'System.Runtime.InteropServices.RuntimeInformation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

推荐答案

安装缺少的软件包.使用软件包安装程序,发出以下命令: 安装包System.Runtime.InteropServices.RuntimeInformation

Install the missing package. Using Package-installer, issue following command: Install-Package System.Runtime.InteropServices.RuntimeInformation

这篇关于MongoDB客户端在mscorlib中抛出FileNotFoundException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆