小程序
小游戏
企业微信
微信支付
扫描小程序码分享
你好 我在推送模版信息的时候 {"errcode":41001,"errmsg":"access_token missing rid: 61381e85-2f2745f1-23f237c1"}
我的APPID 和appsecret都没有错啊,微信支付是可以的啊。
2 个回答
加粗
标红
插入代码
插入链接
插入图片
上传视频
#region 获取access_token
string appid = "wx-----6d58";
string appsecret = "8---d04de3759710e";
string apiurl = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + appid + "&secret=" + appsecret + "";
WebRequest request = WebRequest.Create(@apiurl);
request.Method = "POST";
WebResponse response = request.GetResponse();
Stream stream = response.GetResponseStream();
Encoding encode = Encoding.UTF8;
StreamReader reader = new StreamReader(stream, encode);
string detail = reader.ReadToEnd();
var jd = JsonConvert.DeserializeObject<WXApi>(detail);
string token = (String)jd.access_token;
#endregion
#region 组装信息推送,并返回结果(其它模版消息于此类似)
string url = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + token;
string temp = "{\"touser\": \"ouih-xH0eiCXDUQGlEhPcLH6XdRk\"," +
"\"template_id\": \"2Sn32y9S26gEDZRO9r5-dhdsJ4kSrGXLwIofyIMvkRQ\", " +
"\"topcolor\": \"#FF0000\", " +
"\"data\": " +
"{\"keyword1\": {\"value\": \"222\"}," +
"\"keyword2\": { \"value\": \"3333\"}," +
"\"remark\": {\"value\": \"您有派送订单未确认,请登录平台查看\" }}}";
//核心代码
string tempresult = GetResponseData(temp, @url);
Response.Write(tempresult);
Response.Write("-----");
JObject jo = JObject.Parse(tempresult);
string errcode = jo["errcode"].ToString(); //读取获取到的ACCESS_TOKEN
Response.Write(errcode);
我的代码是这样的 以前没问题 的 改了公众号就这样了
你好,麻烦通过点击下方“反馈信息”按钮,提供出现问题的。
检查调用接口的时候 有没有传 access_token
关注后,可在微信内接收相应的重要提醒。
请使用微信扫描二维码关注 “微信开放社区” 公众号
#region 获取access_token
string appid = "wx-----6d58";
string appsecret = "8---d04de3759710e";
string apiurl = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + appid + "&secret=" + appsecret + "";
WebRequest request = WebRequest.Create(@apiurl);
request.Method = "POST";
WebResponse response = request.GetResponse();
Stream stream = response.GetResponseStream();
Encoding encode = Encoding.UTF8;
StreamReader reader = new StreamReader(stream, encode);
string detail = reader.ReadToEnd();
var jd = JsonConvert.DeserializeObject<WXApi>(detail);
string token = (String)jd.access_token;
#endregion
#region 组装信息推送,并返回结果(其它模版消息于此类似)
string url = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + token;
string temp = "{\"touser\": \"ouih-xH0eiCXDUQGlEhPcLH6XdRk\"," +
"\"template_id\": \"2Sn32y9S26gEDZRO9r5-dhdsJ4kSrGXLwIofyIMvkRQ\", " +
"\"topcolor\": \"#FF0000\", " +
"\"data\": " +
"{\"keyword1\": {\"value\": \"222\"}," +
"\"keyword2\": { \"value\": \"3333\"}," +
"\"remark\": {\"value\": \"您有派送订单未确认,请登录平台查看\" }}}";
#endregion
//核心代码
string tempresult = GetResponseData(temp, @url);
Response.Write(tempresult);
Response.Write("-----");
JObject jo = JObject.Parse(tempresult);
string errcode = jo["errcode"].ToString(); //读取获取到的ACCESS_TOKEN
Response.Write(errcode);
Response.Write("-----");
我的代码是这样的 以前没问题 的 改了公众号就这样了
检查调用接口的时候 有没有传 access_token