I was trying to find a Current mobile location,It's working.
After that POST the data in my local server. when I post the data in the server it will display this error.
async void AddressButton_OnClick(object sender, EventArgs eventArgs)
{
if (currentLocation == null)
{
addressText.Text = "Can't determine the current address. Try again in a few minutes.";
return;
}
Address address = await ReverseGeocodeCurrentLocation();
DisplayAddress(address);
#region HttpResponce
try
{
var request = HttpWebRequest.Create(string.Format(@"http://192.168.1.88:53706/api/Getlocation", ""));
request.ContentType = "application/json";
request.Method = "POST";
using (HttpWebResponse response = request.GetResponse() as HttpWebResponse) //Error display this line
{
if (response.StatusCode != HttpStatusCode.OK)
System.Console.Out.WriteLine("Error fetching data. Server returned status code: {0}", response.StatusCode);
using (StreamReader reader = new StreamReader(response.GetResponseStream()))
{
var content = reader.ReadToEnd();
if (string.IsNullOrWhiteSpace(content))
{
System.Console.Out.WriteLine("Response contained empty body...");
}
else
{
System.Console.Out.WriteLine("Response Body: \r\n {0}", addressText);
}
}
}
}
catch (System.Exception ex) when (ex is System.Net.Sockets.SocketException ||
ex is InvalidOperationException )
{
System.Console.Out.
WriteLine("task has been cancelled.");
System.Console.Out.WriteLine(ex.Message);
}
#endregion
}
how to solve Timeout issue ...?