DrewE
DrewE

Reputation: 463

Target locally running .net core api service from a Xamarin Android emulator

I have a .net core service running locally. The service is fired up through Visual Studio, and is running on localhost:45689. I want to target this locally running service from an android application running on a Visual Studio Android emulator. The emulator is running on the same machine as the service.

Using localhost:45689 as the host for requests from the application to the service doesn't work because localhost refers to the emulated device, and not my machine. I tried using [ipaddress]:45689, and allowing requests inbound through the firewall for port 45689. However, these requests just sit and time out.

If the service was being hosted through IIS, I could figure it out. However, the hosting through IIS express seems to be causing me issues. Is there any way to target my service in this manor from the emulated device?

Thanks, Drew

Upvotes: 1

Views: 203

Answers (1)

DrewE
DrewE

Reputation: 463

The final solution was to use iisexpress-proxy.

However, I had to add a header value of host:localhost. Pulled that little nugget from the comments on the link from Jason https://programmingflow.com/2017/02/25/iis-express-on-external-ip.html

-Drew

Upvotes: 1

Related Questions