I try to deploy my Mongo database in Mongolabs, everything works fine, and I create a new database. Please see my connectionstring.
public DbHelper()
Make sure the database username is also case sensitive. I ran into this issue because of case sensitivity of the username.
Same Error Message but not encountered with a MongoLabs deployment.
I just encountered the same error listed in the title with an Asp.Net Core App. My issue was due to an IOC configuration issue.
In my IOC container, my wrapped MongoClient instance was configured with a dependency transient lifestyle.
Per The MongoDb C# Driver:
It is recommended to store a MongoClient instance in a global place, either as a static variable or in an IoC container with a singleton lifetime.
I promoted the lifestyle of my object to a singleton and it resolved the issue.
I am using:
Please reference the C# Driver Client section: http://mongodb.github.io/mongo-csharp-driver/2.5/reference/driver/connecting/#re-use
Add "?connect=replicaSet" to the end of your connection string if connecting to MongoLab.
new MongoClient("mongodb://username:password@ds011111.mongolab.com:11111/db-name?connect=replicaSet")
This JIRA ticket has some details: https://jira.mongodb.org/browse/CSHARP-1160
Basically the default is to connect to a replica set member. But MongoLab's Single-Node settings are actually a single node replica set and this causes us to not trust it. Appending ?connect=replicaSet to your connection string will force the driver to move into replica set mode and all will work.
Found that info here.