我现在正在经历同样的问题。我在iOS和Android上有一个项目。在iOS中的REST调用中可以完美运行,但是当我运行Android项目时,会发生以下错误:
错误:
http://floating-point-gui.de/errors/comparison/
下面,微软建议的设置:
遵循以下代码:
var client = new HttpClient(new NativeMessageHandler());
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, ApiUrlBase + string.Format(ApiUrl, method, param));
HttpResponseMessage response = await client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead);
if (response.IsSuccessStatusCode)
{
string resultContent = await response.Content.ReadAsStringAsync();
rootobject = JsonConvert.DeserializeObject<T>(resultContent);
}