PROBLEM:
I am trying to access data from a remote Bugzilla server using Bugzilla's REST API. Whenever I await a response from HttpClient.GetAsync
, this exception is thrown.
WHAT I'VE TRIED:
In an effort to understand the exception, I've investigated the following SO questions and GitHub issues:
- Meaning of “The server returned an invalid or unrecognized response” in HttpClient
- The server returned an invalid or unrecognized response" error when ...
- HttpClient fails with "The server returned an invalid or unrecognized ...
CORE CODE:
The purpose of the code below is to get the Bugzilla version of the server at _url_version
. For example, if I set _url_version = "https://bugzilla.mozilla.org/rest/version"
, I get a valid response.
// Get version, dummy test to ensure REST API is working via http requests
public async Task<string> GetVersion()
{
using (var client = new HttpClient())
{
HttpResponseMessage response = await client.GetAsync(_url_version);
string json = await response.Content.ReadAsStringAsync();
return JsonConvert.DeserializeObject<Rootobject>(json).version;
}
}
QUESTION:
What is the meaning of this exception? What could be causing the communication break between my application and the remote Bugzilla server?