简体   繁体   中英

Can't run build on TFS, autorization error

I have following situation - I have build service that serves project collection on

http://localhost:7575/tfs/defaultcollection

Build service and TFS running on the same virtual machine.

But when I run build from VS build failed with exception:

TF215097: An error occurred while initializing a build for build definition \HelloWorld\test___3: 
Exception Message: One or more errors occurred. (type AggregateException)
Exception Stack Trace:    at System.Threading.Tasks.Task`1.GetResultCore(Boolean     waitCompletionNotification)

at Microsoft.TeamFoundation.Build.Client.FileContainerHelper.GetFile(TfsTeamProjectCollection projectCollection, String itemPath, Stream outputStream)
at     Microsoft.TeamFoundation.Build.Client.FileContainerHelper.GetFileAsString(TfsTeamProjectCollection   projectCollection, String itemPath)
at Microsoft.TeamFoundation.Build.Client.ProcessTemplate.Download(String sourceGetVersion)
at            Microsoft.TeamFoundation.Build.Hosting.BuildControllerWorkflowManager.PrepareRequestForBuild(Workflow    ManagerActivity activity, IBuildDetail build, WorkflowRequest request, IDictionary`2 dataContext)
at Microsoft.TeamFoundation.Build.Hosting.BuildWorkflowManager.TryStartWorkflow(WorkflowRequest request, WorkflowManagerActivity activity, BuildWorkflowInstance& workflowInstance, Exception& error,  Boolean& syncLockTaken)

Inner Exception Details:

Exception Message: VS30063: You are not authorized to access http://HelloWorld.com:7575. (type    VssUnauthorizedException)
Exception Stack Trace:    at Microsoft.VisualStudio.Services.Common.VssHttpMessageHandler.<SendAsync>d__0.MoveNext()

--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at Microsoft.VisualStudio.Services.WebApi.VssHttpRetryMessageHandler.<SendAsync>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at Microsoft.VisualStudio.Services.WebApi.HttpClientExtensions.  <DownloadFileFromTfsAsync>d__2.MoveNext()    

Correct me if I wrong - when build started, he requested TFS build service, service calls TFS DefaultCollection address, invokes active controller with free agent, and build starts.

In my case build service calls wrong DefaultCollection address - http://HelloWorld.com:7575 instead http://localhost:7575/tfs , and for these cause authentication failed.

So, am I rigth in my suggestions, and what I can do to fix it?

I've added following code in TFSBuildServiceHost.exe.config file

<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>

and got in log only that:

[, PID 13344, TID 15088, 2014/09/18 10:09:07.917] Web method running:     [http://localhost:7575/tfs/defaultcollection/_apis/connectionData?    connectOptions=IncludeServices&lastChangeId=-1] (GET)connectionData[connectionData]
[, PID 13344, TID 10064, 2014/09/18 10:09:08.100] Web method response: [http://localhost:7575/tfs/defaultcollection/_apis/connectionData?connectOptions=IncludeServices&lastChangeId=-1] (GET)connectionData[connectionData] 181 ms

确保以管理员身份运行VS。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM