3

I've managed to use the following guide for enabling my VS2015 Android Emulator access to a ASP.NET WEP API running on my local-host which is great :-

http://briannoyesblog.azurewebsites.net/2016/03/06/calling-localhost-web-apis-from-visual-studio-android-emulator/

But i would also like to configure my Xamarin application for enabling my external android device the same access to the web api.

At present, when running from device, the webclient makes the request but it never completes, which leaves the application hanging.

Does anyone know how I can achieve this?

2
  • what did you set in your applicationhost.config ? Commented Feb 21, 2017 at 10:50
  • The Ip address of the Network2 Adapter for the emulator as in the tutorial. It works fine on the emulator but not on the physical device. Commented Feb 21, 2017 at 10:53

1 Answer 1

1

Check your applicationhost.config, find the bindings for your WebApi. There should be something like this:

<binding protocol="http" bindingInformation="*:<your-port>:localhost" />

Add a binding for external requests:

<binding protocol="http" bindingInformation="*:<your-port>:*" />

Then your device can make requests to

<your-network-IP-of-your-machine>:<your-port>

Your device and your machine hosting the WebApi needs to be in the same network, e.g. your local WiFi.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.