How to handle 230 seconds timeout in Azure App Service
Azure Load Balancer has a default idle timeout setting of four minutes. This setting is generally a reasonable response time limit for a web request. App Service returns a timeout to the client if your application does not return a response within approximately 240 seconds (230 seconds on Windows app, 240 seconds on Linux app).
230 seconds is the maximum amount of time that a request can take without sending any data back to the response. It is not configurable. This is because of the default idle timeout of Azure Load Balancer.
If sending data back to keep it alive is not feasible, you can move to an async model where the client makes a request, gets some sort of ticket or identifier that can poll back to see if the processing is done.The suggested approach is to move to an async pattern. i.e.
- First request starts the script and returns an http 202
- Subsequent requests from client check the work, and eventually return 200 when it’s done.
If your web app requires background processing, we recommend using Azure WebJobs. The Azure web app can call WebJobs and be notified when background processing is finished. You can choose from multiple methods for using WebJobs, including queues and triggers.
The alternatives you can explore are moving your app to Azure Cloud Services or on an Azure VM hosting IIS where you can configure these settings.