[英]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.