【发布时间】:2019-08-27 10:45:35
【问题描述】:
我正在尝试从 WPF 应用程序调用 https API,但出现此错误:
InnerException = {"底层连接已关闭:意外 发送时出错。"} Message = "发送时出错 请求。”
谁能帮我看看到底是什么问题?
private static readonly string apiURL =
"https://api.totalsynergy.com/api/v2/Profile/Index";
private async Task<bool> GetAuth(string accessToken)
{
try
{
HttpClient hc = new HttpClient();
HttpResponseMessage hpm = await hc.GetAsync(apiURL);
if (hpm.IsSuccessStatusCode)
{
var res = await hpm.Content.ReadAsAsync<Organization>();
}
return boolValue;
}
catch (HttpRequestException e)
{
Console.WriteLine("\nException Caught!");
Console.WriteLine("Message :{0} ", e.Message);
return boolValue;
}
}
【问题讨论】: