开发者

How do I diagnose connection problems with MongoDB

开发者 https://www.devze.com 2023-01-16 13:24 出处:网络
Using the c# driver and MongoDB on windows server.Connection code looks like this: using (var mongo = new Mongo(ConnectionString))

Using the c# driver and MongoDB on windows server. Connection code looks like this:

using (var mongo = new Mongo(ConnectionString))
{
     mongo.Connect();  
     //do stuff
     mongo.Disconnect();
}

if ConnectionString == "mongodb://LocalHost/MyCollection"

everything is fine if ConnectionString == anything else... doesn't work... even if I use my local IP

IE:

mongodb://192.168.0.55/MyCollection

Fails with the error:

"No connection could be made because the target machine actively refused it 192.168.0.55:27017"

Mongo IS running, I can connect on the other machine locally..

I'm at a loss for how to diagnose/fix this issue, a开发者_运维问答ny suggestions?


Is Windows Firewall blocking access?


You must add a rule with the specified port (27017 is the default) in the Windows Firewall and surely will works.

0

精彩评论

暂无评论...
验证码 换一张
取 消