Api call connection resets
-
Hello, In an ASP .Net Core 8 API, we have an issue with the processing of a call that lasts longer than 2 minutes. It lasts long because we have to parse a ton of files (call can be 5-6 minutes), we know this should be improved, but that's beside the point here. In a previous version of this API (.Net Framework 4.8), this call used to last just as long, and the API did not reset the connection. In the .Net 8 version, we get such a message : Connection id "xxx" reset. Connection id "xxx" sending FIN because: "The Socket transport's send loop completed gracefully." Connection id "xxx" disconnecting. After some googling and copilot'ing, we found that this seems related to Kestrel configuration, so we tried several things: - serverOptions.Limits.KeepAliveTimeout = TimeSpan.FromMinutes(5); - Changed a few parameters related to timeouts in IIS - Changed the timeout parameter from the client app calling the API .. but nothing works. Does anyone have experience with this ? It's clear that the timeout duration has to be adjusted somewhere, but we have no idea where to look. Thanks in advance :)
-
Hello, In an ASP .Net Core 8 API, we have an issue with the processing of a call that lasts longer than 2 minutes. It lasts long because we have to parse a ton of files (call can be 5-6 minutes), we know this should be improved, but that's beside the point here. In a previous version of this API (.Net Framework 4.8), this call used to last just as long, and the API did not reset the connection. In the .Net 8 version, we get such a message : Connection id "xxx" reset. Connection id "xxx" sending FIN because: "The Socket transport's send loop completed gracefully." Connection id "xxx" disconnecting. After some googling and copilot'ing, we found that this seems related to Kestrel configuration, so we tried several things: - serverOptions.Limits.KeepAliveTimeout = TimeSpan.FromMinutes(5); - Changed a few parameters related to timeouts in IIS - Changed the timeout parameter from the client app calling the API .. but nothing works. Does anyone have experience with this ? It's clear that the timeout duration has to be adjusted somewhere, but we have no idea where to look. Thanks in advance :)
Ok, so problem solved, my colleague found the parameter that controls this, here's the info, hopefully it will help someone! In the web.config, you can set the parameter requestTimeout to the value you want, as in :
Alternatively you can also set this parameter via the Configuration Editor in IIS.
-
Ok, so problem solved, my colleague found the parameter that controls this, here's the info, hopefully it will help someone! In the web.config, you can set the parameter requestTimeout to the value you want, as in :
Alternatively you can also set this parameter via the Configuration Editor in IIS.
you will get the same error if your request runs more than `00:05:00`, maybe you can run the long running task in background task/thread (hangfire maybe) and then keep on reading the status from another api method.
===================================================== The grass is always greener on the other side of the fence