System.Net.Sockets.SocketException (0x80004005): No such host is known


I have two server machine. One windows machine on which .Net application running and another Linux machine on which Mongo Db is configured.

.Net application on Windows machine access database on Linux. But there is some random error on connecting to Mongo Database. Error is random and goes after frequent retry.

 **System.Net.Sockets.SocketException (0x80004005): No such host is known
   at System.Net.Dns.GetAddrInfo(String name)
   at System.Net.Dns.InternalGetHostByName(String hostName, Boolean includeIPv6)
   at System.Net.Dns.GetHostEntry(String hostNameOrAddress) 
   on connecting/login**

Is this issue related to database or there is some configuration issue with MongoDb

asked on Stack Overflow Mar 25, 2020 by user334223

1 Answer


I had an issue like this a couple of days ago... What I would try:

  1. Open the task manager and make sure there are no threads running in the background at the same port you have configured on your DB...
  2. If you are using a virtual machine make sure your network state is set to bridge
  3. If 1 & 2 doesn't work try to change the port on your database

Hope it helps

answered on Stack Overflow Mar 25, 2020 by Adrian Efford

User contributions licensed under CC BY-SA 3.0