0

I found this peculiar behaviour of UWP HttpClient.

For a simple get call of WCF service is taking time almost more than 100 seconds(happens for first few calls). I observed that the same service is way too faster in iOS and rest client.

Attaching the code, Please let me know, if i doing wrong.

            HttpClientHandler clientHandler = new HttpClientHandler();
            clientHandler.UseCookies = true;

            var client = new HttpClient(clientHandler);
            client.Timeout = TimeSpan.FromSeconds(100);

            client.DefaultRequestHeaders.Add("Accept", "application/json");

            var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, 
            requestUri);
            var response = await client.SendAsync(httpRequestMessage);

            //Between these lines there is a delay, it doesnt fire time out 
            also. I tried with HttpCompletionOption. No luck

            if (response.IsSuccessStatusCode)
            {
                var content = await response.Content.ReadAsStringAsync(); 

            }

Any help will be really appreciated.

Thanks and Regards,

Rummy

4

0 回答 0