0

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.
  • You can try adding `ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 Or SecurityProtocolType.Tls11 Or SecurityProtocolType.Tls` before making the call. For specifics you can see [this post](https://stackoverflow.com/questions/5420656/unable-to-read-data-from-the-transport-connection-an-existing-connection-was-f). – Lan Huang May 06 '22 at 09:44
  • Thank you very much, this works. Now i get the connection and the Workitems but after this i get an error: read ECONNRESET Could not get response. I must google this. – KarsaOrlong1981 May 06 '22 at 10:27
  • With the WCF TestClient now i get response and the Workitems, but with Postman now i get Error: connect ECONNREFUSED 127.0.0.1:64917. or Error: read ECONNRESET. – KarsaOrlong1981 May 06 '22 at 10:35
  • Maybe you can look at [this](https://stackoverflow.com/a/66541320/17218587). – Lan Huang May 09 '22 at 10:00
  • Thank you. But In the end it was because the datetime values ​​in my object weren't nullable and JSON couldn't handle the .net MinDate. – KarsaOrlong1981 May 10 '22 at 18:47

0 Answers0