我自己解决了,我发现问题在于httpClient使用一次后,就会被销毁,不能重复用,我的HttpClient放的位置不对
Dim ur As String = "https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token={0}"
'删除Dim hc As new HttpClient(Cexp(ur,Functions.Execute("Web_GetQYAccessToken")))
Dim drs As List(of DataRow)= DataTables("MHuserInfo").SQLSe lect("WXUserID is not null and MHUserName in (se lect distinct WhourApproveUser from WhourInfo where WhourStatus =1)")
For Each dr As DataRow In drs
'重新放这里Dim hc As new HttpClient(Cexp(ur,Functions.Execute("Web_GetQYAccessToken")))
Dim jo As New JObject
Dim ja As New JArray
Dim s As String = dr("WxUserID")
jo("touser") = s
jo("msgtype") = "news"
Dim tb_AgentID As WinForm.TextBox = Forms("Mainform").Controls("TextBox_AgentID")
s = tb_AgentID.Value
jo("agentid") = s
For i As Integer = 1 To 1 '可以一次发送最多8个图文消息,这里只发送了1个
Dim ao As New JObject()
Dim su As Integer = DataTables("WHourInfo").SQLCompute("Count(*)","WHourApproveUser ='" & dr("MHUserName") & "' And WhourStatus =1")
s = "您有" & su & "条的工时申报未审核"
ao("title") = s '标题
ao("description") = "请及时审核工时申报,提高大家积极性" '描述
Dim tb_http As WinForm.TextBox = Forms("Mainform").Controls("TextBox_Http")
s = "http://" & tb_http.Value & "/WhourList.htm" '连接
ao("url") =s
ao("picurl") = "http://foxupdate.mbldt.com/MH13ServerUpdate/approve.jpg" '图片
ja.Add(ao)
Next
jo("news") = New JObject()
jo("news")("articles") = ja
hc.Content = jo.ToString()
jo = JObject.Parse(hc.GetData)
Next