I am using Visual Studio 2013 Update 4, and I have set up an api web project to receive receive requests that return an array. For a client application, I have a cordova setup and emulation of an android angular application using an ng resource to call the web api get. Every time I call GET, I get a ripple.js message stating that the connection is rejected. I get a connection failure even if I try with a real Android device. Here is the error when using the ripple emulator
OPTIONS http://****:4400/ripple/xhr_proxy?tinyhippos_apikey=ABC&tinyhippos_rur…Fget%3D%257B%2522method%2522%3A%2522GET%2522%2C%2522array%2522%3Atrue%257D net::ERR_CONNECTION_REFUSED
I was sure that I enabled cors on the api 2 web server, since the cordova and web api projects are different port numbers on the same local host. I proved not only the functionality of cors, but also the code by creating an exact copy of the cordova angular application with only the angular web page. I also tried with the postman, and both answered json correctly. This is only android cordova app which gives me connection rejection. Any help would be greatly appreciated!
Here is what angular looks like:
app.factory('mrMaintService', function ($resource) { return $resource('http://localhost:15528/api/requests', { get: { method: 'GET', array: true } }); });
This shows that I resolve all domains in the web api project:
<httpProtocol> <customHeaders> <add name="Access-Control-Allow-Origin" value="*" /> </customHeaders> </httpProtocol>
source share