HttpClient PostAsync error: The request was aborted: The connection was closed unexpectedly

I have a VB.net application that I need to connect to an API Controller coded in PHP with Laravel as the framework. I am getting the below error when the code hits PostAsync.

System.AggregateException was caught
  HResult=-2146233088
  Message=One or more errors occurred.
  Source=mscorlib
  StackTrace:
       at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
       at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
       at System.Threading.Tasks.Task`1.get_Result()
       at .Common.Web._Closure$__1._Lambda$__1() in C:Users...Web.vb:line 82
  InnerException: System.Net.Http.HttpRequestException
       HResult=-2146233088
       Message=An error occurred while sending the request.
       InnerException: System.Net.WebException
            HResult=-2146233079
            Message=The request was aborted: The connection was closed unexpectedly.
            Source=System
            StackTrace:
                 at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
                 at System.Net.ConnectStream.ReadWithoutValidation(Byte[] buffer, Int32 offset, Int32 size, Boolean abortOnError)

This is the code:

Private Shared Function MakeRequest(ByVal RequestedUrl As String, ByVal Params As Dictionary(Of String, String)) As Task(Of WebResponse)

            Return Threading.Tasks.Task(Of WebResponse).Factory.StartNew(
                Function()
                    Dim httpResponse As HttpResponseMessage = Nothing
                    Try
                        Using httpClient As HttpClient = New HttpClient()

                            Dim tmp As String = _httpMethod
                            If Not _apiUrl.EndsWith("/") Then
                                tmp = _httpMethod + "://"
                            End If

                            System.Net.ServicePointManager.SecurityProtocol = DirectCast(3072, System.Net.SecurityProtocolType)
                            Dim responseStatus As Threading.Tasks.Task(Of HttpResponseMessage) = httpClient.PostAsync(tmp & _apiUrl, New FormUrlEncodedContent(Params))
                            httpResponse = responseStatus.Result
                            httpResponse.EnsureSuccessStatusCode()

                            Dim responseContent As Threading.Tasks.Task(Of String) = httpResponse.Content.ReadAsStringAsync()
                            Dim responseBody As String = responseContent.Result

                            Dim webResponse As WebResponse = JsonConvert.DeserializeObject(Of WebResponse)(responseBody)
                            Return webResponse

                        End Using
                    Catch ex As Exception
                        If httpResponse IsNot Nothing Then
                            Return New WebResponse(CInt(httpResponse.StatusCode).ToString(), "Error " + CInt(httpResponse.StatusCode).ToString() + ": " + ex.Message, Nothing)
                        Else
                            Return New WebResponse("500", ex.Message, Nothing)
                        End If
                    End Try
                End Function)

        End Function

I have tried everything I could find on google with the same error but nothing seems to work. I am using XAMPP v3.2.2 with Apache 2.4.37.0 and OpenSSL 1.1.1a.

The server doesn’t seem to allow the client (VB.net app, using TLS 1.2) to connect and I am puzzled why. The Apache access logs don’t help either. Note that I can connect to the API via Postman and it does the POST request successfully.

I really hope someone can shed some light on this as I am stuck here for days.