c#-mongodb连接出错:MongoDB.Driver.MongoAuthenticationException: Invalid credentials for database...

c#-mongodb连接出错:MongoDB.Driver.MongoAuthenticationException: Invalid credentials for database...

原因:可能没有按照正确的方式写链接字符串

连接mongodb字符串:

(1)需要用户名密码验证的:mongodb://uname:pwd@127.0.0.1:27017  

uname为用户名,pwd为密码。

(2)不需要用户名密码验证的:mongodb://127.0.0.1:27017

 

posted on 2016-05-17 18:38  FIGHTING360  阅读(4523)  评论(4编辑  收藏  举报