I have encountered a strange problem when using HttpClient,the code show below.
- Environment: k8s
- Internet: intranet
- App: .NET Core 3.1
Code:
using (var httpClient = new HttpClient())
{
httpClient.Timeout = new TimeSpan(2, 0, 0);
using var httpContent = new StringContent(JsonConvert.SerializeObject(exportParameter), Encoding.UTF8, "application/json");
var httpResponseMessage = await httpClient.PostAsync($"{url}", httpContent);
}
This is a file export scene, if it's a small file export (the response is very fast, less than 5 minutes, most of this scene) -- never had any problems.
But when we perform a large file export(the response size is about 100MB and waiting time is more than one hour but less than two hours), the httpclient requester will prompt
The application aborted the connection
and the httpclient
gets no response.
Does anyone know what is causing the problem?
Thanks