public static async Task <LocationFromIPAddress> GetLocationFromIP() { HttpClient httpClient = new HttpClient(); try { HttpResponseMessage response = await httpClient.GetAsync("https://freegeoip.app/json/").ConfigureAwait(false); string responseBodyStr = response.Content.ReadAsStringAsync().Result; LocationFromIPAddress location = Messaging <LocationFromIPAddress> .Deserialize(responseBodyStr); return(location); } catch (Exception) { return(new LocationFromIPAddress() { latitude = 37.3382f, longitude = 121.8863f }); } }