Reputation: 3579
For the time being at least I have to provide a synchronous service via WebAPI where the response takes several minute to produce. I have tried to do my homework on this and have web.config set up per MS docs and several SO posts, specifically:
When I call the API with Postman it stops after awhile and displays "Status 500 OK Time 230089 ms" (about 4 min). The folks using the client just get a 500 error. But the application is NOT throwing an exception and the process completes successfully. Just no client anymore to receive the response.
Going to dig into the server logs but hoping somebody will be able answer this and save me some time. Thanks.
Upvotes: 0
Views: 738
Reputation: 3579
One of my teammates resolved the problem first by changing from an Azure web app to one of our VMs. He then followed the lead from this MS forum post: Azure Powershell - IdleTimeoutInMinutes value for VM: "we ... resolved it by creating a load-balanced endpoint, then setting the timeout value for that."
Upvotes: 0
Reputation: 142094
It is potentially going to be very difficult to get a reliable solution taking your current approach. You may have successfully set the timeout for the IIS server that is hosting your application, however, there could be any number of intermediate components that are sitting between your client and the server that could have their own timeout values. For example on Azure your request is likely being routed through ARR. Even if you could control that network component, the clients that are going to call your API have proxies sitting in their network that have their own timeout values.
For long running requests like this, the best option is to return a 202 response with a location header that contains a URL that your client should poll waiting for the long running operation to complete.
Upvotes: 1