system.net.http.httpclient does not respect timespan above 100 seconds (.Net standard 2.0.2)
Hey
We have encountered a problem where the HTTP client provided by system.net does not respect any timeout giving above 100 seconds on a iOS tablet application written in .Net / Xamarin
It is defined as below:
HttpClient HttpClientLongTimeout = new HttpClient(HttpClientHandler);
HttpClientLongTimeout.Timeout = TimeSpan.FromMinutes(10);
And then called on by
var response = await HttpClientLongTimeout.GetAsync(url).ConfigureAwait(false);
As long as the value is over 100 seconds then it does not seem to care and simply fails with a timeout exception that leads to a task was cancelled exception.
We have tried to add the following as a workaround, but it did not have any effect either.
NSUrlSessionConfiguration.DefaultSessionConfiguration.TimeoutIntervalForRequest = 30000.0;
NSUrlSessionConfiguration.DefaultSessionConfiguration.TimeoutIntervalForResource = 30000.0;
It seems from debugging that the timeout value for the request is reset to default 100 seconds at a system level.
Can you offer any advice to how we can get around this?