First off, thanks for the replies. I’m sure this may seem like either I’m a newbie altogether, or this topic is simply not related to Ionic, both good reasons to ignore me.
Anyway, I have been able to get beyond 500 errors to a 415 - unsupported media type error. This would seem to be an issue with the object I’m sending in the post body. Just to recap:
I have an API built in visual studio. I can run it in debugging mode at localhost:someport.
I have an ionic app built in a separate IDE. I have a proxy set to get around CORS in ionic.config.json. I can run the app in the browser using ionic serve, and all my requests work perfectly. The app is built and all seems fine in browser.
I deploy the API to my server, and all GET requests come back to my browser fine, so I know the API is functioning, but when I go to test the app on my device or even from a service like hurl.it the server returns 415, unsupported media type.
I am getting the post request body this way:
let reqBody = [];
let criteria = this.searchCriteriaForm.value;
for (var k in criteria) {
if (criteria.hasOwnProperty(k)) {
reqBody.push({
'searchField' : k,
'searchTerm' : criteria[k]
});
}
}
console.log(reqBody);
this.navCtrl.push('SearchResultsPage', {
'criteria' : reqBody
});
The SearchResultsPage is making the request this way:
this.http.post(url, queryObj).map(res => res.json()).subscribe(data =>
{ this.stuff = data; });
This all works fine localhost to localhost, but when I make the request to the live IIS server I get the unsupported media type issue. My assumption here is that I have something configured wrong with the API, but it’s strange to me that it would handle the request fine in development and not on the server itself.
Any advice would be appreciated.