Victor
Victor

Reputation: 8975

MongoNetworkError: connect ECONNREFUSED 172.18.44.22:27017 (Windows Server 2019/Windows 10)

I installed:

But when trying to connect the MongoDB server on the Windows Server 2019 from the Windows 10 I receive the following error:

MongoNetworkError: connect ECONNREFUSED 172.18.44.22:27017

I checked:

I checked a lot of posts on StackOverflow: most of these related to Linux, the rest are describing solutions that don't help.

What might be problem?


When I launch mongosh locally on the Windows Server 2019 it is running without a problem.

Thanks

Upvotes: 0

Views: 95

Answers (1)

Wernfried Domscheit
Wernfried Domscheit

Reputation: 59557

Double click on the service and have a look at "Path to Executable", should be something like C:\Program Files\MongoDB\mongod.exe --config ...

Have a look at the config file, most likely it contains these lines:

net:
  port: 27017
  bindIp: localhost

Which means, the MongoDB listens to localhost and you can connect only from your local machine. To enable connections from other computers change it to

net:
  port: 27017
  bindIpAll: true

and restart the service.

Upvotes: 1

Related Questions