Dim dt As DataTable = DataTables("默认用户")
Dim dr As DataRow = dt.Find("ID = '1'")
If dr IsNot Nothing Then
Dim url As String = dr("url") '接口网址
Dim appid As String = dr("appid") '开发者ID
Dim appsecret As String = dr("appsecret") '开发者密匙
url = url & "/restoken/dstoken/get.do?a={0}&s={1}"
Dim hc As New HttpClient(CExp(url,appid,appsecret))
Dim ret As String = hc.GetData()
If ret = "" Then '如果失败,再尝试一次
hc.GetData()
End If
Dim jo As JObject = JObject.Parse(ret)
If jo("code") = "0" Then
AccessTocken = jo("access_token")
Else
AccessTocken = ""
End If
End If
2021-12-22 16:09:48.8163
基础连接已经关闭: 发送时发生错误。
在 System.Net.HttpWebRequest.GetResponse()
在 Foxtable.HttpClient.GetData(Boolean SkipError2)
由于远程方已关闭传输流,身份验证失败。
在 System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
在 System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
在 System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
在 System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
在 System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)
在 System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)
在 System.Net.TlsStream.CallProcessAuthentication(Object state)
在 System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
在 System.Net.TlsStream.ProcessAuthentication(LazyAsyncResult result)
在 System.Net.TlsStream.Write(Byte[] buffer, Int32 offset, Int32 size)
在 System.Net.PooledStream.Write(Byte[] buffer, Int32 offset, Int32 size)
在 System.Net.ConnectStream.WriteHeaders(Boolean async)
[此贴子已经被作者于2021/12/23 9:13:46编辑过]