I recently started developing a web API for my application for Windows Phone 8, and when I try to connect it to my application (via WebClient, HttpRequest and HttpClient), it ends in the same way, just disconnects my Internet connection without any information . The site I'm trying to reach is gtlol.necroworks.net/free. Has anyone else encountered a similar situation and / or found some answer?
More details:
Examples of HttpClient and WebClient requests:
using (HttpClient hc = new HttpClient())
{
hc.BaseAddress = new Uri("http://gtlol.necroworks.net/");
HttpResponseMessage response = await hc.GetAsync("free");
if (response.IsSuccessStatusCode)
{
var res = await response.Content.ReadAsStringAsync();
MessageBox.Show(res);
}
else
{
MessageBox.Show("Not working - no internet connection");
}
}
WebClient freeRotationWebClient = new WebClient();
freeRotationWebClient.DownloadStringCompleted += new DownloadStringCompletedEventHandler(webClient_GetRotation);
freeRotationWebClient.DownloadStringAsync(new Uri("http://gtlol.necroworks.net/free"));
private void webClient_GetRotation(object sender, DownloadStringCompletedEventArgs e)
{
try
{
if (!e.Cancelled)
{
MessageBox.Show((string)e.Result);
}
}
catch (Exception ex)
{
MessageBox.Show("Not working");
}
}
Both em should return this result:
[{"_id":"53d264aa6e65634e49000000","champId":53},{"_id":"53d264ab6e65634e49010000","champId":36},{"_id":"53d264ab6e65634e49020000","champId":79},{"_id":"53d264ab6e65634e49030000","champId":96},{"_id":"53d264ab6e65634e49040000","champId":75},{"_id":"53d264ab6e65634e49050000","champId":72},{"_id":"53d264ac6e65634e49060000","champId":48},{"_id":"53d264ac6e65634e49070000","champId":6},{"_id":"53d264ac6e65634e49080000","champId":101},{"_id":"53d264ac6e65634e49090000","champId":115}]
, reset - - - . , , , 404.
-API, , .
, , , api:
Accept-Ranges →bytes
Age →0
Connection →keep-alive
Content-Length →482
Content-Type →application/json;charset=utf-8
Date →Wed, 30 Jul 2014 18:44:45 GMT
Server →nginx
Via →1.1 varnish
X-Content-Type-Options →nosniff
X-Varnish →584616320
api, , :
Access-Control-Allow-Headers →Content-Type
Access-Control-Allow-Methods →GET, POST, DELETE, PUT
Access-Control-Allow-Origin →*
Connection →keep-alive
Content-Encoding →gzip
Content-Length →161
Content-Type →application/json; charset=UTF-8
Date →Wed, 30 Jul 2014 18:45:13 GMT
Server →Jetty(9.1.1.v20140108)
Vary →Accept-Encoding, User-Agent
X-NewRelic-App-Data →