How to get data from an Web API hosted in iis with ionic

Hi guys,

I have been trying to make web API requests to my ASP.Net core 2.2 web API that is hosted in IIS. I can get back results when I use ‘’ from my browser. However, I get ‘Host could not be resolved: Unable to resolve host “”: No address associated with hostname’ when I make the same request from my app. My PC and phone are both on the same network. After testing with different domains, :

Is there something from my url, am I not following the correct syntax? here’s other peices of my code:

In my AndroidManifest.xml
“xml”: “<uses-permission android:name=“android.permission.INTERNET” />”

this.nativeHttp.setHeader(‘localhost’,‘content-type’, ‘application/json’);

  await'http://192.168.8.X/api/Vehicle/GetCarpaint', JSON.stringify(payload), {})
  .then( res => { 
    let parsed = JSON.parse(
    return parsed.result })
  .catch(err => { console.log(err) })

I get the same error, have you been able to solve this?


I was able to solve it by:

  • removing the Host name of the site (when you add site)
  • add an inbound rule at the system’s firewall settings
  • add this line at the bottom of the hosts file in the C:\Windows\System32\drivers\etc

Then everything shall work according.

1 Like