获取access_token异常
黑面小男生 发布于2018-04 浏览:12720 回复:6
0
收藏
在使用获取 access_token方法的时候报这个异常: An unhandled exception of type 'System.AggregateException' occurred in mscorlib.dll,
怎么解?
收藏
点赞
0
个赞
共6条回复 最后由156******37回复于2022-07
#16用户已被禁言回复于2022-04
0
#6hefeitest回复于2018-10

我用c#没遇到你的问题,复制粘贴过来就可以用了

0
#5用户已被禁言回复于2018-04
#4 黑面小男生回复
您好,我用的是 c# 的调用,以下是 C# 的 API 文档中的调用代码,测试的时候会在红色字体的地方报这个异常 String authHost = "https://aip.baidubce.com/oauth/2.0/token"; HttpClient client = new HttpClient(); List<KeyValuePair<String, String>> paraList = new List<KeyValuePair<string, string>>(); paraList.Add(new KeyValuePair<string, string>("grant_type", "client_credentials")); paraList.Add(new KeyValuePair<string, string>("client_id", clientId)); paraList.Add(new KeyValuePair<string, string>("client_secret", clientSecret)); HttpResponseMessage response = client.PostAsync(authHost, new FormUrlEncodedContent(paraList)).Result; result = response.Content.ReadAsStringAsync().Result; Console.WriteLine(result); return result;
展开
0
#4黑面小男生回复于2018-04
#2 用户已被禁言回复
这是啥语言调用呢?一般接口都会返回json格式的字符串

您好,我用的是 c# 的调用,以下是 C# 的 API 文档中的调用代码,测试的时候会在红色字体的地方报这个异常

String authHost = "https://aip.baidubce.com/oauth/2.0/token";
HttpClient client = new HttpClient();
List> paraList = new List>();
paraList.Add(new KeyValuePair("grant_type", "client_credentials"));
paraList.Add(new KeyValuePair("client_id", clientId));
paraList.Add(new KeyValuePair("client_secret", clientSecret));

HttpResponseMessage response = client.PostAsync(authHost, new FormUrlEncodedContent(paraList)).Result;
result = response.Content.ReadAsStringAsync().Result;
Console.WriteLine(result);
return result;

0
#3黑面小男生回复于2018-04

您好,我用的是 c# 的调用,以下是 C# 的 API 文档中的调用代码,测试的时候会在红色字体的地方报这个异常

String authHost = "https://aip.baidubce.com/oauth/2.0/token";
HttpClient client = new HttpClient();
List> paraList = new List>();
paraList.Add(new KeyValuePair("grant_type", "client_credentials"));
paraList.Add(new KeyValuePair("client_id", clientId));
paraList.Add(new KeyValuePair("client_secret", clientSecret));

HttpResponseMessage response = client.PostAsync(authHost, new FormUrlEncodedContent(paraList)).Result;
result = response.Content.ReadAsStringAsync().Result;
Console.WriteLine(result);
return result;

0
#2用户已被禁言回复于2018-04

这是啥语言调用呢?一般接口都会返回json格式的字符串

1
TOP
切换版块