A timeout occured after 30000ms selecting a server using CompositeServerSelector

前端 未结 9 1735
南方客
南方客 2020-11-27 07:39

I try to deploy my Mongo database in Mongolabs, everything works fine, and I create a new database. Please see my connectionstring.

    public DbHelper()
            


        
9条回答
  •  离开以前
    2020-11-27 08:03

    Make Sure your auth db is set correctly.

    I ran into this issue when I mentioned only the DB i wanted to connect to , and my auth db was different (other than admin db ).

    The db-name in this line is considered as the auth DB .

    new MongoClient("mongodb://username:password@ds011111.mongolab.com:11111/db-name?connect=replicaSet")
    

    Then you can change the selected DB Later

    mDb = mClient.GetDatabase(mongoDBName);
    

提交回复
热议问题