简体   繁体   English

尝试连接到 Xamarin 中的 MongoDB 客户端时出现系统聚合异常

[英]Getting System Aggregate Exception when trying to connect to MongoDB client in Xamarin

I have a MongoDB database on a remote Azure server.我在远程 Azure 服务器上有一个 MongoDB 数据库。 I have an app I'm writing on Xamarin and I'm trying to connect to my remote server, but I always get an exception as following:我有一个我正在 Xamarin 上编写的应用程序,我正在尝试连接到我的远程服务器,但我总是遇到如下异常:

System.AggregateException: 'Error resolving name servers (Value cannot be null. Parameter name: source) (Could not find file "/etc/resolv.conf")' System.AggregateException:'解析名称服务器时出错(值不能是 null。参数名称:源)(找不到文件“/etc/resolv.conf”)'

I'm getting this exception from this line of code:我从这行代码中得到了这个异常:

var client = new MongoClient("connection_string");

The connection_string is the connection string I get from my Azure account, and I also tried connect to it from the Mongo Compass and it worked, so I'm guessing there's no problem of authentication or with the connection string. connection_string 是我从我的 Azure 帐户获得的连接字符串,我还尝试从 Mongo Compass 连接到它并且它有效,所以我猜身份验证或连接字符串没有问题。 Of course I also have the MongoDB nugets needed for connection to this database.当然,我也有连接到该数据库所需的 MongoDB nugets。

Any help will be appreciated, Thanks!任何帮助将不胜感激,谢谢!

Yesterday I was getting that exact same error, and after following several tutorial in internet without success, I managed to fix my problem by installing via Nudget an earlier version of MongoDB: 2.7.0 instead of the last (2.10.0).昨天我遇到了完全相同的错误,在互联网上遵循了几个教程但没有成功后,我设法通过 Nudget 安装了一个早期版本的 MongoDB: 2.7.0而不是最后一个 (2.10.0) 来解决我的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 尝试进行socket.Connect时收到套接字异常10054 - getting Socket Exception 10054 when trying to socket.Connect 尝试从Vista中的标准用户帐户访问文件时获取System.UnauthorizedAccess异常 - Getting a System.UnauthorizedAccess exception when trying to access a file from a standard user account in vista 通过Xamarin中的Smtp客户端获取例外发送电子邮件 - Getting Exception Sending Email through Smtp Client in Xamarin 尝试将 Arduino 连接到 Unity 时出现超时异常 - Timeout Exception when trying to connect Arduino to Unity 尝试连接到.sdf数据库时出现异常 - Exception when trying to connect to .sdf database 尝试连接到SQL Azure数据库时发生异常 - Exception when trying to connect to SQL Azure Database VS 2015:尝试连接到Excel时出现“抛出异常:System.Data.dll中的'System.Data.OleDb.OleDbException'” - VS 2015: Getting “Exception thrown: 'System.Data.OleDb.OleDbException' in System.Data.dll” When Attempting Connect to Excel 尝试渲染时出现System.Argument异常 - System.Argument Exception When Trying to Render 使用.Net的系统聚合异常 - System Aggregate Exception using .Net 尝试连接到blob存储时出错 - Getting error when trying to connect to blob storage
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM