Jul 19, 2018

Accessing a local .NET website (API) from a Xamarin app

The Android emulator has a nifty feature to allow apps to access the host computers local address,, by using*port*. If you are trying to connect to a .NET api you're developing running at http://localhost:60765 let's say, you'd put Unfortunately this wont work because IIS Express binds to localhost not Fortunately the fix is simple. Open the folder containing your .NET solution and navigate to .vs\config\applicationhost.config (note .vs is a hidden folder) then search for the port you are running on, you should find something like this within the <sites> tag.

<site name="MySite" id="2">
    <application path="/" applicationPool="Clr4IntegratedAppPool">
        <virtualDirectory path="/" physicalPath="C:\Users\..." />
        <binding protocol="http" bindingInformation="*:60765:localhost" />

Change localhost to and voila, it should now be accessible from your app.

Tags: xamarin, iis express, .net

No Comments

Add a Comment