I am trying to fetch data from our API instance. The code I have is pretty much copied MS website with teaks found on SO. The code that I am using is this:
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;
}
The configuration values are good... I can copy them and paste them into a cURL command and get the data. Same with the headers.
Now when I debug, execution stops after executing this line:
HttpResponseMessage response = await httpClient.GetAsync(peopleEndpoint);
And, in the output window, all I see is:
The program '[10172] dotnet.exe' has exited with code 0 (0x0).
The program '[10172] dotnet.exe: Program Trace' has exited with code 0 (0x0).
How can I figure out what is causing this failure?
The framework is noted as:
<TargetFramework>netcoreapp2.1</TargetFramework>