Had an interesting case recently. Customer was using an on-prem build controller connected to VSO. His Team Project was backed by Git and he had a team build using the GitTemplate.12.xaml Build Template. Problem was the build definition was failing about 78% of the time. The build itself completed, but the final phase failed. The error was:
Exception Message: The HTTP request timed out after 00:01:40. (type TimeoutException)
Exception Stack Trace: at Microsoft.TeamFoundation.Build.Workflow.Activities.FileContainerDropProvider.EndCopyDirectory(IAsyncResult result)
at Microsoft.TeamFoundation.Build.Workflow.Activities.CopyDirectory.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
Inner Exception Details:
Exception Message: A task was canceled. (type TaskCanceledException)
Exception Stack Trace: at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
- We tested building a simple Hello World VS project and that built 100% (no errors).
- The failing build had the “Copy build output to the server” option selected on the “Build defaults” tab. We changed this to both “Copy build output to the following drop folder“ and “This build does not copy output files to a drop folder” and the build succeeded in each case.
Finally came to find a fix. In tfsbuildservicehost.exe.config* add the appSettings key of ServerDrop.MaxRequestTimeInSeconds with an int value for seconds. As an example add this...
<add key="ServerDrop.MaxRequestTimeInSeconds" value="300"/>
...and now the timeout is 5 minutes.
*C:\Program Files\Microsoft Team Foundation Server 12.0\Tools is where you’ll usually find tfsbuildservicehost.exe.config. You may need to turn on “FILE NAME EXTENSIONS” in File Explorer.