Click here to Skip to main content
15,880,392 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
We have a VB 2010 Desktop program (built and deployed to msi) .Net 4.5 program that has been working for years on all supported versions of Windows.

Over the past few weeks it no longer works correctly on Windows 10 including our client and from our development system.

It is actually trying to get orders from the WordPress/WooCommerce API (WP API V1 or V2).

The error received is
One or more errors occurred. An error occurred while sending the request.

Using client As HttpClient = New HttpClient()
                client.DefaultRequestHeaders.Accept.Add(New MediaTypeWithQualityHeaderValue("application/json"))
                Dim v As Object = Nothing
                If pJSON = NIL Then

                    v = client.GetStringAsync(pURL)
                Else
                    Static myTestSwt As Boolean = False
                    If MyTesting AndAlso TestingDontUpdate Then
                        If Not myTestSwt Then
                            Stop
                            myTestSwt = True
                        End If
                    End If

                    Dim requestMessage = New HttpRequestMessage
                    Dim httpContent As StringContent = New StringContent(pJSON, Encoding.UTF8, "application/json")

                    Dim result As HttpResponseMessage = Nothing ' As Object = Nothing

                    result = client.PutAsync(pURL, httpContent).Result
                    If result.IsSuccessStatusCode Then
                        funRC = True
                        pOutJSON = "{""AaaTeXStatus"": ""OK""}"
                    Else
                        pOutReason = result.StatusCode & Sp & result.ReasonPhrase ' & SP & requestMessage.ToString
                    End If

                    GoTo ExitFunction
                End If

                If v Is Nothing Then
                    GoTo ExitFunction
                End If
                If v.Result Is Nothing Then  ' 401 unauthorized ' should be json
                    GoTo ExitFunction
                End If
                pOutJSON = v.Result  '  json response
            End Using
Catch ex As Exception
            pOutReason = ex.Message
            If ex.InnerException IsNot Nothing Then pOutReason &= Sp & ex.InnerException.Message
 
        End Try


What I have tried:

On Windows 7 works from VS 2010 IDE and exe.
On Windows 10 worked from VS 2017 IDE.
Posted
Updated 13-Feb-18 5:46am
Comments
Dave Kreskowiak 13-Feb-18 11:49am    
Without knowing the error messages, everyone is just guessing. That's not a very efficient way of solving the problem.
Richard Deeming 13-Feb-18 12:53pm    
Debug your code and inspect the full exception.

Hint: There can often be more than one level of InnerExceptions.

1 solution

Changing the compatibility mode of the exe in Windows 10 might help ...
It can be found through exe properties, on the "Compatibility" tab,
- perhaps setting compatibility to Windows 7 would solve the issue,
BR,
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900