How to Troubleshoot TFS Build Server Failure?

Posted by Tarun Arora on Geeks with Blogs See other posts from Geeks with Blogs or by Tarun Arora
Published on Tue, 15 Nov 2011 00:49:00 GMT Indexed on 2011/11/15 1:54 UTC
Read the original article Hit count: 850

Filed under:

 

Ever found your self in this helpless situation where you think you have tried every possible suggestion on the internet to bring the build server back but it just won’t work. Well some times before hunting around for a solution it is important to understand what the problem is, if the error messages in the build logs don’t seem to help you can always enable tracing on the build server to get more information on what could possibly be the root cause of failure.

image

In this blog post today I’ll be showing you how to enable tracing on,

- TFS 2010/11 Server

- Build Server

- Client

image

Enable Tracing on Team Foundation Server 2010/2011

  • On the Team Foundation Server navigate to C:\Program Files\Microsoft Team Foundation Server 2010\Application Tier\Web Services, right click web.config and from the context menu select edit.

         image

  • Search for the <appSettings> node in the config file and set the value of the key ‘traceWriter’ to true.

         image

  • In the <System.diagnostics> tag set the value of switches from 0 to 4 to set the trace level to maximum to write diagnostics level trace information.

         image

  • Restart the TFS Application pool to force this change to take effect. The application pool restart will impact any one using the TFS server at present. Note - It is recommended that you do not make any changes to the TFS production application server, this can have serious consequences and can even jeopardize the installation of your server.

         image

        image

Enable Tracing on Build Controller/Agents

  • Log on to the Build Controller/Agent and Navigate to the directory C:\Program Files\Microsoft Team Foundation Server 2010\Tools

        image

  • Look for the configuration file ‘TFSBuildServiceHost.exe.config’ if it is not already there create a new text file and rename it to ‘TFSBuildServiceHost.exe.config’

        image

  • To Enable tracing uncomment the <system.diagnostics> and paste the snippet below if it is not already there.
<configuration>
  <system.diagnostics>
    <switches>
      <add name="BuildServiceTraceLevel" value="4"/>
    </switches>
    <trace autoflush="true" indentsize="4">
      <listeners>
        <add name="myListener" type="Microsoft.TeamFoundation.TeamFoundationTextWriterTraceListener,
             Microsoft.TeamFoundation.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" 
             initializeData="c:\logs\TFSBuildServiceHost.exe.log" />
        <remove name="Default" />
      </listeners>
    </trace>
  </system.diagnostics>
</configuration>
  • The highlighted path above is where the Log file will be created. If the folder is not already there then create the folder, also, make sure that the account running the build service has access to write to this folder.

        image

  • Restart the build Controller/Agent service from the administration console (or net stop tfsbuildservicehost & net start tfsbuildservicehost) in order for the new setting to be picked up.

        image

Enable TFS Tracing on the Client Machine

  • On the client machine, shut down Visual Studio, navigate to C:\Program Files\Microsoft Visual Studio 10.0\Common 7\IDE

         image

  • Search for devenv.exe.config, make a backup copy of the config file and right click the file and from the context menu select edit. If its not already there create this file.

         image

  • Edit devenv.exe.config by adding the below code snippet before the last </configuration> tag
<system.diagnostics>
  <switches>
    <add name="TeamFoundationSoapProxy" value="4" />
    <add name="VersionControl" value="4" />
  </switches>
  <trace autoflush="true" indentsize="3">
    <listeners>
      <add name="myListener"
      type="Microsoft.TeamFoundation.TeamFoundationTextWriterTraceListener,Microsoft.TeamFoundation.Common, 
          Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
          initializeData="c:\tf.log" />
      <add name="perfListener" type="Microsoft.TeamFoundation.Client.PerfTraceListener,
           Microsoft.TeamFoundation.Client, 
           Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
    </listeners>
  </trace>
</system.diagnostics>
  • The highlighted path above is where the Log file will be created. If the folder is not already there then create the folder.
  • Start Visual Studio and after a bit of activity you should be able to see the new log file being created on the folder specified in the config file.

Other Resources

Below are some Key resource you might like to review. I would highly recommend the documentation, walkthroughs and videos available on MSDN.

image

 

Thank you for taking the time out and reading this blog post. If you enjoyed the post, remember to subscribe to http://feeds.feedburner.com/TarunArora. Have you come across an interesting one to one with the build server, please share your experience here. Questions/Feedback/Suggestions, etc please leave a comment.

Thank You!

Share this post :

© Geeks with Blogs or respective owner