Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

HttpRequest get request timeouts for some of the calls while it is a success for other calls .

$
0
0

Im trying to make a get request and while it able to get data for certain values it timeouts for the others. However when i make the call from post UI it is consistently successful which proves that nothing is wrong with the service . I've found an issue(github.com/mono/mono/issues/11455) online which is similar but couldn't understand if it is solved or not from the comments

Below is the code

try
{
var uri = new Uri(CommonManager.ProdServiceUrl + "GetDeliveryProfileDetails/" + storeNumber);

            var request = new HttpRequestMessage()
            {
                RequestUri = uri,
                Method = HttpMethod.Get
            };
            // Add header information
            AddRequestHeaderInfo(request);

            HttpResponseMessage response = await client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead);

            if ((response.StatusCode == System.Net.HttpStatusCode.OK) && (response.IsSuccessStatusCode))
            {
                var responseContent = await response.Content.ReadAsStringAsync();
                DeliveryProfileInfo = JsonConvert.DeserializeObject<DeliveryProfileInfo>(responseContent);
            }
            else
            {
                var responseContent = await response.Content.ReadAsStringAsync();
                var errorResult = JsonConvert.DeserializeObject<ApiServiceStatus>(responseContent);
                throw new Exception(errorResult.ResponseCode + " - " + errorResult.ResponseMessage);
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }

Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>