TFS build service cannot connect to a TFS 2012 server – seeing EventID 206 MessageQueue in error log

Whilst setting up our new TFS 2012 instance I had a problem getting the build box to connect to the TFS server.

  1. When I started the build service (on a dedicated VM configured as a controller and single agent, connected to a TPC on the server on another VM). All appears OK, the controller and agents said they were running and state icons went green
  2. About 5 seconds later the state icons go red, but message says the controller and agents are still running, from past experience I know this means it is all dead.
  3. On the build service section a new ‘details’ link appears, but if you try to click it get a 404 error (see below)

image

In the windows event log (TFS/Build-Service/Operational section) I got the error

Build machine build2012 lost connectivity to message queue tfsmq://buildservicehost-2/.
Reason: HTTP code 404: Not Found

It is recorded as EventID 206  in the category MessageQueue

I tried reinstalling the build VM and checked the firewalls on the build VM and the TFS Server VM, all to no effect.

The issue turned out to be that the TFS URL I had used. I had used a TFS URL on the build service VM to connect to the TFS server that used HTTPS/SSL. As soon as I changed it to an HTTP URL the build service started to work. This was OK for me as the build VM and server VM were in the same machine room, so I did not really need SLL. I had just used it out of habit as this is what our developer PCs use.

However, if you did want to keep using SSL you need to do the following

  • Open the following configuration file: C:\Program Files\Microsoft Team Foundation Server 2012\Application Tier\Message Queue\web.config
  • Find a section like the bindings section below
  • Alter httpTransport to say httpsTransport

    <bindings>
      <customBinding>
        <binding name="TfsSoapBinding">
          <textMessageEncoding messageVersion="Soap12WSAddressing10" />
          <httpTransport authenticationScheme="Ntlm" manualAddressing="true" />
          <httpsTransport authenticationScheme="Ntlm" manualAddressing="true" />
        </binding>
      </customBinding>
    </bindings>

  • Save the file
  • Recycle the IIS app pool
  • Restart the build service on the build VM

Thanks to Patrick on the TFS team for helping me get to the bottom of this.