Sometimes I get the following error while I was doing HttpWebRequest to a WebService. I copied my code below too.
System.Net.WebException: Unable to connect
it might be because of authorisation issues; that was the case for me. If you have for example: [Authorize("WriteAccess")] or [Authorize("ReadAccess")] at the top of your controller functions, try to comment them out.
[Authorize("WriteAccess")]
[Authorize("ReadAccess")]