我需要使用以下标题从url获取响应:
HttpClient httpClient = new HttpClient();
httpClient.DefaultRequestHeaders.Add("Content-Type", "application/json");
httpClient.DefaultRequestHeaders.Add("X-apiKey", App.API_Key);
string responseAsString = await httpClient.GetStringAsync("http://......./");
它在此行停止运行,没有任何responseAsString值:
httpClient.DefaultRequestHeaders.Add("Content-Type", "application/json");