we resolved this problem with 2 code changes:
-
Dispose of the httpResponseMessage and just work with a simple DTO
using (var httpResponseMessage = await httpClient.SendAsync(httpRequestMessage)) { return await CreateDto(httpResponseMessage); } -
Downgrade the version of HTTP to v1.0
var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, new Uri(url)) { Version = HttpVersion.Version10, Content = httpContent }; await client.SendAsync(httpRequestMessage);
which has the effect of adding this Http header
Connection: close
rather than this
Connection: keep-alive