c# HttpClient 只是停止而没有任何指示为什么

c# HttpClient just stops without any indication why

我正在尝试从我们的 API 实例中获取数据。我拥有的代码几乎是复制的 MS 网站,其中包含在 SO 上找到的柚木。我使用的代码是这样的:

string peopleEndpoint = $"{apiConf.ApiEndpoint}/{apiConf.dbspec}/_table/mdm.PEOPLE_SV";
string json = null;
try
{
    using (var httpClient = new HttpClient())
    {
        httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
        httpClient.DefaultRequestHeaders.Add("X-Api-Key", apiConf.ApiKey);
        HttpResponseMessage response = await httpClient.GetAsync(peopleEndpoint);
        json = await response.Content.ReadAsStringAsync();
    }
}
catch (Exception ex)
{
    Debug.WriteLine(ex.ToString());
    throw;
}

配置值很好...我可以将它们复制并粘贴到 cURL 命令中并获取数据。与 headers.

相同

现在当我调试时,执行此行后停止:

HttpResponseMessage response = await httpClient.GetAsync(peopleEndpoint);

而且,在输出 window 中,我只看到:

The program '[10172] dotnet.exe' has exited with code 0 (0x0).
The program '[10172] dotnet.exe: Program Trace' has exited with code 0 (0x0).

如何找出导致此故障的原因?

框架标注为:

<TargetFramework>netcoreapp2.1</TargetFramework>

代码是一直异步到顶部还是有一个非异步方法在某处调用此代码可能不会等到它完成。这就是我的味道。