“No such host is known” error in Visual Studio
Published Feb 11 2019 07:17 AM 45.4K Views
Microsoft

Error messages like “Socket Exception: No such host is known” refers to issues in the code or configuration of your application. Here is an example error message:

 

System.Net.Sockets.SocketException: No such host is known

cc1.jpg

 

Root cause

In my case, the root cause was a failure in DNS name resolution. The application was trying to call an API but it is not able to find the hostname.

 

Solution

Your server should be able to access to the DNS server. Additionally, your DNS server should be able to lookup the hostname that is in your code. Troubleshooting steps:

  • Run ipconfig /all in Command Prompt. Fin the IP addresses of the DNS server in the output. Try to ping it.
  • Run nslookup. Enter the hostname from your code. The DNS server should be able to reach this hostname.
  • Make sure there is no typo or white spaces in the hostname. In case you are getting this input from a JSON call or configuration file, the source string and the variable might have different values.
Version history
Last update:
‎Feb 11 2019 07:17 AM
Updated by: