Thursday, October 31, 2013

Resolution: Visual Studio Test Agent Unable to Connect to the controller. There is no agent registered...

Problem: I discovered a weird quirk with the Visual Studio Test Agents (a.k.a. TFS Test Agents). We were trying to set them up to do some load testing, and were getting the error below.

 Unable to connect to the controller on 'MyController:6901'. There is no agent with the name 'MyAgent' registered on the controller.

If you click on the "View Log" link after attempting to configure the Test Agent, you will see the follwing detailed error:

 V, 2013/10/28, 17:33:25.342, Observed that agent 'MyAgent' does not exist. Microsoft.VisualStudio.TestTools.Exceptions.EqtException: There is no agent with
the name 'MyAgent' registered on the controller.
 Server stack trace:
   at Microsoft.VisualStudio.TestTools.Controller.AgentManager.GetAgentMachine(String agentName)
   at Microsoft.VisualStudio.TestTools.Controller.AgentManager.GetAgentProperties(String agentName)
   at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
   at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)
 Exception rethrown at [0]:
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at Microsoft.VisualStudio.TestTools.Execution.IControllerCommands.GetAgentProperties(String agentName)
   at Microsoft.VisualStudio.TestTools.ConfigCore.TestControllerHelper.AgentExists(String agentName, IControllerCommands controllerCmds)

Cause: The problem I had was that the agent's host file had some entries in there pointing to the loopback IP address of For some reason, the controller grabbed the host names from the hosts file on the agent machines, and was trying to talk back to them based on the information in DNS. In our case, this was the load balancers, not the agent machines.

  1. Comment out any hostfile entries on the agent machines that have the IP address with a "#" pound sign.
  2. Run "ipconfig /flushdns" on the agent and the controller.
  3. Restart all of the services starting with "Visual Studio" on both the agent and the controller.
  4. Rerun the agent configuration.
Note* If you are trying to run the agent on a machine in the cloud, on a workgroup member computer, or a computer from another domain, see this article as well.