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 ‘example.com:50056/api/Vehicle/GetCarpaint’ from my browser. However, I get ‘Host could not be resolved: java.net.UnknownHostException: Unable to resolve host “drsmashservices.com”: 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, :
- http://192.168.8.X/api/Vehicle/GetCarpaint [Error 404 File or directory not found]
- http://192.168.8.X:50056/api/Vehicle/GetCarpaint [Error 400 Bad Request -Invalid Hostname]
-
example.com:50056/api/Vehicle/GetCarpaint [Host could not be resolved:
java.net.UnknownHostException: Unable to resolve host “drsmashservices.com”: No address
associated with hostname]
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 this.nativeHttp.post('http://192.168.8.X/api/Vehicle/GetCarpaint', JSON.stringify(payload), {})
.then( res => {
let parsed = JSON.parse(res.data)
return parsed.result })
.catch(err => { console.log(err) })