Error when you try to search a server in VMware vCenter client: Login to the query service failed

When using the VMware vCenter client you get the error message: Login to the query service failed.
A connection failure occured (Unable to connect to the remote server)
VMware vCenter query
Check if you are able to resolve the FQDN for the ESX server.
I had to put the IP and host in the hosts file on my Windows machine – C:\Windows\System32\drivers\etc\hosts