通过REST API连接到Azure DevOps失败

发布于 2025-01-26 14:52:58 字数 1330 浏览 0 评论 0原文

我目前正在研究REST API,以便能够通过IT调用WCF服务。现在,当我尝试使用此方法通过Azure DevOps调用任务时,我遇到了问题,

      <OperationContract()>
<WebGet(UriTemplate:="/todos?user={sUser}&projectID={lProjektID}", BodyStyle:=WebMessageBodyStyle.Wrapped, RequestFormat:=WebMessageFormat.Json, ResponseFormat:=WebMessageFormat.Json)>
Function GetTodos(Optional ByVal sUser As String = "%", Optional ByVal lProjektID As Long = Nothing) As List(Of ProjektToDo)

在此尝试将其连接到Azure DevOps之后,我会在此处获得这些例外:

     Dim creds As New VssBasicCredential(String.Empty, _DevOpsPAT)
    Dim connection As VssConnection = New VssConnection(New Uri(My.Settings.TFSBasisUrlSSL), creds)
    'Create instance of WorkItemTrackingHttpClient using VssConnection
    Dim witClient As WorkItemTrackingHttpClient = connection.GetClient(Of WorkItemTrackingHttpClient) 'This connection fails !'
    Dim queryHierarchyItems As List(Of QueryHierarchyItem) = witClient.GetQueriesAsync(Projekt,, 2).Result
  • “ System.net.sockets.sockets.socketException in System.dll
  • ” system.io 中。
  • ​.http.httprequestexception“在mscorlib.dll中。
  • ex.message的innerexception告诉我“现有连接是由远程主机关闭的”消息:“无法从传输连接中读取数据”。 我目前正在一家新公司培训,并且在REST API和WCF服务方面没有经验,请帮助我,我迫切希望这项任务,因为我只是不知道从哪里开始。

I am currently working on a REST API to be able to call a WCF service via it. Now I have the problem when I try to call up tasks via Azure DevOps using this method,

      <OperationContract()>
<WebGet(UriTemplate:="/todos?user={sUser}&projectID={lProjektID}", BodyStyle:=WebMessageBodyStyle.Wrapped, RequestFormat:=WebMessageFormat.Json, ResponseFormat:=WebMessageFormat.Json)>
Function GetTodos(Optional ByVal sUser As String = "%", Optional ByVal lProjektID As Long = Nothing) As List(Of ProjektToDo)

I get these exceptions after trying to connect to Azure Devops at this:

     Dim creds As New VssBasicCredential(String.Empty, _DevOpsPAT)
    Dim connection As VssConnection = New VssConnection(New Uri(My.Settings.TFSBasisUrlSSL), creds)
    'Create instance of WorkItemTrackingHttpClient using VssConnection
    Dim witClient As WorkItemTrackingHttpClient = connection.GetClient(Of WorkItemTrackingHttpClient) 'This connection fails !'
    Dim queryHierarchyItems As List(Of QueryHierarchyItem) = witClient.GetQueriesAsync(Projekt,, 2).Result
  • "System.Net.Sockets.SocketException" in System.dll
  • "System.IO.IOException" in System.dll
  • "System.ObjectDisposedException" in System.dll
  • "System.Net.WebException" in System.dll
  • "System.Net.Http.HttpRequestException" in Microsoft.VisualStudio.Services.Common.dll
  • "System.Net.Http.HttpRequestException" in mscorlib.dll.
  • The InnerException of the ex.Message tells me "An existing connection was closed by the remote host" Message: "Unable to read data from the transfer connection".
    I'm currently training in a new company and have no experience in the area of ​​Rest API and WCF Service, please help me I'm desperate about this task because I just don't know where to start.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文