我在 Windows 7 Pro 64bit 上安装了 MongoDB 3.0.1。我所做的一切都是在这台服务器上完成的,所有连接都是通过 127.0.0.1:27017 进行的。是的,我已经应用了 MongoDB 推荐的 MS Hotfix。这是我的完整配置文件:
systemLog:
destination: file
path: "C:\\Program Files\\MongoDB\\Server\\3.0\\data\\log\\mongod.log"
logAppend: true
storage:
dbPath: "C:\\Program Files\\MongoDB\\Server\\3.0\\data\\db"
security:
authorization: enabled
我创建了一个这样的超级用户:
db.createUser({user:"superuser", pwd:"temp",
roles:[ "userAdminAnyDatabase", "readWrite" ] } )
我可以像这样登录 mongo 控制台:
mongo.exe 127.0.0.1:27017/admin -u superuser -p temp --authenticationDatabase admin --verbose
然后我可以从 mongo 控制台做任何事情。但是当我尝试连接诸如 Mongovue 或 Robomongo 之类的管理 UI 时,连接被拒绝。Mongovue 吐出这个堆栈跟踪:
Connection was refused
Unable to connect to server 127.0.0.1:27017: Object reference not set to an instance of an object..
Type: MongoDB.Driver.MongoConnectionException
Stack: at MongoDB.Driver.Internal.DirectMongoServerProxy.Connect(TimeSpan timeout, ReadPreference readPreference)
at MongoDB.Driver.MongoServer.Connect(TimeSpan timeout)
at MongoDB.Driver.MongoServer.Connect()
at MangoUI.MMongo.QSDlL5xzK686iCExThO(Object )
at MangoUI.MMongo.Open(Boolean mustWrite)
at MangoUI.MMongo.Open()
at MangoUI.MConnection.get_IsValid()
at MangoUI.WinConnect.SCOjR9kYRPerNNngykW(Object )
at MangoUI.WinConnect.btnTest_Click(Object sender, EventArgs e)
Object reference not set to an instance of an object.
Type: System.NullReferenceException
Stack: at MongoDB.Driver.MongoServerInstance.RefreshStateAsSoonAsPossible()
at MongoDB.Driver.Internal.MongoConnection.HandleException(Exception ex)
at MongoDB.Driver.Internal.MongoConnection.SendMessage(BsonBuffer buffer, Int32 requestId)
at MongoDB.Driver.Internal.MongoConnection.SendMessage(MongoRequestMessage message)
at MongoDB.Driver.Operations.CommandOperation`1.Execute(MongoConnection connection)
at MongoDB.Driver.MongoServerInstance.RunCommandAs[TCommandResult](MongoConnection connection, String databaseName, IMongoCommand command)
at MongoDB.Driver.MongoServerInstance.Ping(MongoConnection connection)
at MongoDB.Driver.MongoServerInstance.Connect()
at MongoDB.Driver.Internal.DirectMongoServerProxy.Connect(TimeSpan timeout, ReadPreference readPreference)
这看起来像一个空指针给我。我在某处缺少配置吗?我需要做什么才能使其正常工作?
谢谢,
沃伦