I have a MongoDB database on a remote Azure server. 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:
System.AggregateException: 'Error resolving name servers (Value cannot be null. Parameter name: source) (Could not find file "/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. Of course I also have the MongoDB nugets needed for connection to this database.
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).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.