Click here to Skip to main content
15,907,906 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using Xamarin Form,Emulator Andorid 11.0 API 30
This is my sentence to access the API
string url = "";

From Swagger: I can run it and it works, but when i use xamarin i got the following error: Connected failed to localhost.
I have used: My Local IP address, b) LocalHost, c), d)
and nothing work.
Pd: I have the same sentence in flutter and it works.

Any idea

What I have tried:

I had checked manuals, internet answers and others soluctions and nothing work
Updated 6-Apr-23 4:08am
David Crow 21-Mar-23 13:08pm    
The code statement you've shown and the error you quote don't match. In other words, assigning a string literal to a string object will not cause such an error. You need to show the actual code snippet that causes the error.

1 solution

As far as I know, emulator does not know localhost. You should run and tunnel your server app, using ngrok or similar app.

Follow this link, I think this [^] the link is similar with your case.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900