2015년 1월 6일 화요일

[mongodb-csharp] Unable to connect to server X.X.X.X:YYYY: Invalid credential for database 'admin'..

I recently updated from version 1.7.0 to the prerelease of 1.9. Now when I try to run my project, I get the following error:

    Unable to connect to server X.X.X.X:YYYY: Invalid credential for database 'admin'..

where the server and port are actual vaules rather than X/Y.

When I revert to version 1.7, everything works fine. Version 1.7.1 also works. Version 1.8.0 manifests the error.
What has changed?  How do I fix this? What other issues am i going to run up against in upgrading? Where can I find an upgrade guide for the csharp driver?



The way credentials are parsed out of the connection string are different, starting in 1.8.  There are some warnings about this in the docs.

I assume your credentials are for a specific database other than admin?  If so, you'll need to specify the database in your connection string.  Consult the official connection string documentation: http://docs.mongodb.org/manual/reference/connection-string/



Thanks for your response. I looked at the documentation and cannot see a problem with my connection string. Here is the format I am using:
    mongodb://myname:mypass@24.24.24.24:24242
This should be valid according to the docs



I see the problem. Thanks for your response. 

What other things should I watch out for in the upgrade? Is there an upgrade guide?



There are release notes for 1.8, 1.8.1, 1.8.2, and 1.8.3.  We also have some for 1.9.  You can read those for the gist of what has happened since 1.7.

Other than that, there aren't many other breaking changes unless you were using conventions heavily in your codebase.  If you were, things mostly should continue to work and as long as your tests pass, everything is ok.



i also had this problem

this cn work fine:
"mongodb://userr:pass@address:27017/dbapplications?slaveOk=true;readPreference=nearest;replicaSet=test1;minPoolSize=50";


댓글 없음:

댓글 쓰기