我也遇到同样问题导致接口无法使用。
Foxtable的httpclient类,底层的HttpWebRequest对象,发送的时候缺少ContentLength属性,对方接口不认。
这个问题最好解决一下或者升级.netframework版本到4.8,到时候我改用其他的类来发。
Dim request As System.Net.HttpWebRequest = CType(System.Net.WebRequest.Create(ExchangeURL ), System.Net.HttpWebRequest)
request.Method = "POST"
Dim postData As String = "grant_type=refresh_token&refresh_token=" & _XeroInfo.refresh_token
Dim byteArray As Byte() = Encoding.UTF8.GetBytes(postData)
request.C
request.ContentLength = byteArray.Length
request.Headers.Add("Authorization", "Basic " & base64EncodedText)
Dim dataStream As System.IO.Stream = request.GetRequestStream()
dataStream.Write(byteArray, 0, byteArray.Length)
dataStream.Close()
Dim response As System.Net.HttpWebResponse = CType(request.GetResponse(), System.Net.HttpWebResponse)
Dim responseStream As System.IO.Stream = response.GetResponseStream()
Dim reader As New System.IO.StreamReader(responseStream, Encoding.UTF8)
Dim responseContent As String = reader.ReadToEnd()
responseStream.Close()
response.Close()