Forum Xamarin.Android

How to test a locally hosted(iis express) api on android simulator

AustyAusty Member ✭✭✭

l did some research and l was told l had to edit the applicationhost.config file and bind the local ip of my computer. after running ipconfig to get the ip of
my local computer( l edited the applicationhost.config file as below

    <site name="FINALKAHPROJECT" id="2">
                    <application path="/" applicationPool="Clr4IntegratedAppPool">
                        <virtualDirectory path="/" physicalPath="C:\Users\SBSC QA TEAM\source\repos\FINALKAHPROJECT\FINALKAHPROJECT\FINALKAHPROJECT" />
                        <binding protocol="http" bindingInformation="*:56745:localhost" />
                         <binding protocol="http" bindingInformation="*:8080:" />

and below is the code in xamarin.forms for consuming the api

 public async void Comic()
            using(var httpClient = new HttpClient()){
                var response = await httpClient.GetStringAsync("");
                var comic = JsonConvert.DeserializeObject<List<Comic>>(response);
                comicList.ItemsSource = comic;

l get the error System.Net.WebException: 'Failed to connect to /' after setting the solution to start multiple projects and running the webapp and mobile app as the same time.Help Please


Sign In or Register to comment.