Galera, boa noite
Estou fazendo uma requisi]ao PostAsync e quando da execução do código: var resultado = await pesquisaDomicilio.PostAsync(UrlPesqDomicilio, conteudo);
entra na execução do Catch e apresenta a seguinte mensagem:
ex = {System.Net.Http.HttpRequestException: An error occurred while sending the request ---> System.Net.WebException:
Error: ConnectFailure (Network is unreachable) ---> System.Net.Sockets.SocketException: Network is unreachable
at System.Net.Sockets.SocketAsy...
e a tela de saida apresena:
02-01 20:01:20.749 D/Mono (31915): Image addref Mono.Security[0xb91fed80] -> Mono.Security.dll[0xb92f1c70]: 2
02-01 20:01:20.749 D/Mono (31915): Prepared to set up assembly 'Mono.Security' (Mono.Security.dll)
02-01 20:01:20.749 D/Mono (31915): Assembly Mono.Security[0xb91fed80] added to domain RootDomain, ref_count=1
02-01 20:01:20.749 D/Mono (31915): AOT: image 'Mono.Security.dll.so' not found: dlopen failed: library "/data/app/Pesquisa.OrigemDestino-1/lib/arm/libaot-Mono.Security.dll.so" not found
02-01 20:01:20.749 D/Mono (31915): AOT: image '/Users/builder/jenkins/workspace/xamarin-android-d15-9/xamarin-android/external/mono/sdks/out/android-armeabi-v7a-release/lib/mono/aot-cache/arm/Mono.Security.dll.so' not found: dlopen failed: library "/data/app/Pesquisa.OrigemDestino-1/lib/arm/libaot-Mono.Security.dll.so" not found
02-01 20:01:20.759 D/Mono (31915): Config attempting to parse: 'Mono.Security.dll.config'.
02-01 20:01:20.759 D/Mono (31915): Config attempting to parse: '/Users/builder/jenkins/workspace/xamarin-android-d15-9/xamarin-android/external/mono/sdks/out/android-armeabi-v7a-release/etc/mono/assemblies/Mono.Security/Mono.Security.config'.
Loaded assembly: Mono.Security.dll [External]02-01 20:01:20.759 D/Mono (31915): Assembly Ref addref System[0xb85ad430] -> Mono.Security[0xb91fed80]: 2
02-01 20:01:20.759 D/Mono (31915): Assembly Ref addref Mono.Security[0xb91fed80] -> mscorlib[0xb82cf600]: 62
02-01 20:01:20.779 D/Mono (31915): Assembly Ref addref System.Net.Http[0xb8399250] -> System.Core[0xb84297f0]: 12
02-01 20:01:20.819 D/Mono (31915): Assembly Ref addref Mono.Android[0xb8207400] -> System[0xb85ad430]: 14
Thread started: <Thread Pool> #4
Thread started: <Thread Pool> #5
Thread started: <Thread Pool> #6
Thread started: <Thread Pool> #7
02-01 20:01:23.469 I/Choreographer(31915): Skipped 5422 frames! The application may be doing too much work on its main thread.
o código que montei é:
public async Task<List<ListaDomicilio>> PesquisaDomicilio()
{
HttpClient httpClient = new HttpClient();
using (var pesquisaDomicilio = new HttpClient())
{
var informacao = JsonConvert.SerializeObject(new
{
Pesquisador = Global.CodigoPesquisador
});
var conteudo = new StringContent(informacao, Encoding.UTF8, "application/json");
try
{
var resultado = await pesquisaDomicilio.PostAsync(UrlPesqDomicilio, conteudo);
var retorno = resultado.Content.ReadAsStringAsync().Result;
var retorno1 = JsonConvert.DeserializeObject<RetornoJson>(retorno);
List<ListaDomicilio> listaDomicilio = JsonConvert.DeserializeObject<List<ListaDomicilio>>(retorno1.Dados.ToString());
if (retorno != null)
{
var retornoMens = JsonConvert.DeserializeObject<ListaDomicilio>(retorno);
if (retorno1.Status == "ERROR" && retorno1.Message != null)
{
return null;
}
else
{
ListaDomicilio retornoData = JsonConvert.DeserializeObject<ListaDomicilio>(retorno1.Dados.ToString());
return listaDomicilio;
}
}
else
{
return null;
}
}
catch (Exception ex)
{
return null;
}
}
}
Alguém sabe o por que do erro?
Grato,