【问题标题】:Getting Microsoft.VisualStudio.Services.Common.VssUnauthorizedException: 'VS30063 when trying to lauch in local IIS尝试在本地 IIS 中启动时获取 Microsoft.VisualStudio.Services.Common.VssUnauthorizedException:'VS30063
【发布时间】:2020-07-14 22:12:50
【问题描述】:

我正在运行一个简单的 Web 应用程序,在 VisualStudio.Services.Common 旁边测试 TeamFoundation.Services.Client 并通过 IIS Express 启动应用程序没有问题,但是当我尝试使用本地 IIS 执行相同操作时,我收到此错误:

Microsoft.VisualStudio.Services.Common.VssUnauthorizedException: 'VS30063: You are not authorized to access http://mytfs:8080.

This exception was originally thrown at this call stack:
    Microsoft.VisualStudio.Services.Common.VssHttpMessageHandler.SendAsync(System.Net.Http.HttpRequestMessage, System.Threading.CancellationToken)
    System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task)
    Microsoft.VisualStudio.Services.Common.VssHttpRetryMessageHandler.SendAsync(System.Net.Http.HttpRequestMessage, System.Threading.CancellationToken)
    System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task)
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task)
    System.Net.Http.HttpClient.FinishSendAsyncBuffered(System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage>, System.Net.Http.HttpRequestMessage, System.Threading.CancellationTokenSource, bool)
    System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    ...
    [Call Stack Truncated]

我不明白问题出在哪里。

这是我尝试启动它的调试配置文件:

这是我得到错误的代码:

internal const string vstsCollectioUrl = "http://myTFS:8080/tfs/MyCollection"; 

//Prompt user for credential
VssConnection connection = new VssConnection(new Uri(vstsCollectioUrl), new VssAadCredential("{user}", "{password}"));

//create http client and query for resutls
WorkItemTrackingHttpClient witClient = connection.GetClient<WorkItemTrackingHttpClient>();

【问题讨论】:

    标签: asp.net-core .net-core tfs azure-devops azure-active-directory


    【解决方案1】:

    VssAadCredential 类默认获取运行该工具的人员的凭据,并且实际上在.net core 项目中不遵守用户名和密码参数,类似于this ticket。所以不能像this那样使用Azure Active Directory Authentication,也不建议在SOAP service中使用AAD Authentication for REST services

    作为一种解决方法,您可以尝试 windows 身份验证:

    VssConnection connection = new VssConnection(new Uri("http://instanceName:8080/tfs/OrgName/"), new WindowsCredential(new NetworkCredential("xxx", "xxx")));
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-07-18
      • 2023-01-30
      • 2020-10-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多