【问题标题】:Timeout exception when connecting to MongoLab using c# driver使用 c# 驱动程序连接到 MongoLab 时出现超时异常
【发布时间】:2015-08-07 06:55:48
【问题描述】:

我正在使用 C# 驱动程序连接到托管在 MongoLab 上的 MongoDB,但我收到了超时异常。

任何想法如何在下面解决它都是我的代码:

    static void Main(string[] args)
    {
        String uri = @"mongodb://test:test@ds011111.mongolab.com:11111/db";

        var client = new MongoClient(uri);

        var db = client.GetDatabase("db");

        Console.WriteLine(client.Cluster.ClusterId.ToString());
        collection = db.GetCollection<BsonDocument>("test");

        GetData();
        Console.ReadKey();
    }

    static async void GetData()
    {
        Console.WriteLine("Connecting....");

        var res = await collection.Find(new BsonDocument()).FirstOrDefaultAsync();

        Console.WriteLine(res);
    }

【问题讨论】:

    标签: c# .net mongodb mlab


    【解决方案1】:

    已解决,由于网络限制出现错误。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-04-06
      • 1970-01-01
      • 2015-08-30
      • 2015-06-15
      • 2013-12-22
      • 2016-08-12
      • 1970-01-01
      相关资源
      最近更新 更多