I am calling ASP.NET web API in android(Java). I have deployed web API on localhost and using localhost URL in API call.
I'm getting connection refused error. I've tried the following:
- Called API using local host URL.
- Called API using 10.0.2.2 IP.
- Called API with my IP address.
- Called API using 127.7.0.0
Kindly suggest what should be done in this scenario.
P.s: I've tested on both emulator and android device. Everything is on same network. Still I get the same error.
Update: Issue is resolved. I have done the following:
- open chrome://inspect/#devices
- select port forwarding.
- forward the port at which web API is deployed on IIS to localhost:8081.
- web api is accessible to emulator and device both.