0

I have a .Net 6 API on a linux container behind an AWS Application load balancer. The load balancer is returning a 502 response for a long running request. The request returns successfully after about a minute when run locally but I get the 502 within 15-19 seconds when running it in PROD behind the load balancer. Load balancer timeout is set to 60 seconds. And I doubt it's the .net timeouts causing it since it runs locally for a minute and returns a 200 response. Also, I haven't configured Keep-Alive or any other timeouts for Kestrel or ASP.Net which means it's using the defaults and, AFAIK, the defaults are all >= 30 seconds.

If it matters, the long running request made by the .net API calls another API configured in a similar manner (AWS load balancer in front of .Net API on linux) and that request is what actually takes a while. The logs for the second load balancer don't have any 5xx errors and if I make the call to the secondary API directly from POSTman, it returns a 200 response after a minute of running.

Ash
  • 5,786
  • 5
  • 22
  • 42
  • Are you using HttpClient or HttpClientFactory to call other APIs from your API. If yes, you should configure the TimeOut there as well. Also, you should increase timeout at Kestrel server as well - https://stackoverflow.com/a/70616939/1273882. Finally increase the timeout at ALB. After all these, if it works, then fine-tune the timeout values. – Ankush Jain Jul 31 '23 at 08:47

0 Answers0