0

I've got an ASP.NET MVC 5 application running with some WebAPI controllers. I have an Android app that sends a request to the WebAPI every second. The strange thing is that it works fine on some phones; the request is sent successfully and the correct function is called. However, on my phone it doesn't work properly; the function is called every 10 to 20 seconds. Then, when I kill the Android app, all the requests suddenly come through and the function is called.

How can this be fixed? Is it perhaps some strange setting on my phone that I must change? I really need the requests to go through every second and get processed.

Using LogCat in Eclipse, I see that an exception is sometimes thrown: org.apache.http.conn.HttpHostConnectException: Connection to http://192.168.1.7:55555 refused.

Thanks for any help.

Update: After some investigating, it appears that the issue is caused by using AsyncTask. I've found something here which has kind of fixed the problem. However, now a batch of requests is sent every few seconds, instead of once every second. I'll try to implement the request-sending without using AsyncTask.

Community
  • 1
  • 1
Mr_Bean
  • 139
  • 1
  • 15
  • Where have you hosted your MVC 5 app? Is it on IISExpress or development server? I suggest you try to deploy it on to a full IIS Site if you have not done that yet, looks like an issue with number of requests the server can handle. – BuddhiP Oct 08 '14 at 14:19
  • @BuddhiP I'm hosting it on my laptop over a local Wi-Fi network. I don't think that's the issue. I was only sending requests from 1 phone at a time. My friend's phone sends fine, but mine does weird things. – Mr_Bean Oct 08 '14 at 14:23

0 Answers0