Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: ConnectFailure (No route to host)

Context: I have a Xamarin.Android app that it connects to an WebAPI for different information.

Issue: When trying to access the server I get the following error:

System.Net.Http.HttpRequestException: An error occurred while sending the request ---> System.Net.WebException: Error: ConnectFailure (No route to host)

Issue context: we have 2 servers in the same network, configured the same (at least we hope so, is at client site) and if we use the same app (same build) we can connect to server A, but get the mentioned error when connecting to B. About the B server: I can access from device browser the http://address/help or /token page, I can also do the desired request from 'REST Api Client' from Google Play and get a successful response. The only problem it seems when connecting from our app to the server B. This issue is also not present on our environments (as I mentioned, the A and B are at client site).

Question: What would be the problem and where should we look further?

Thank you!

like image 345
Alexandru Stefan Avatar asked Apr 03 '17 10:04

Alexandru Stefan


1 Answers

I found this answer on Xamarin forms, this didn't solve my problem, but maybe it could help in yours. https://forums.xamarin.com/discussion/70731/connection-error-no-route-to-host-only-happens-on-android

I had this problem because I didn't dispose my HttpClient object. It didn't happen with the first or second request, however from request 10 it would start giving me problems. Especially when they were happening asynchronously.

I don't know if this will solve your problem, as both these seem to be a special case instance. Maybe yours is a special case as well.

like image 191
Oli4 Avatar answered Nov 07 '22 07:11

Oli4