You use .net core api project, and you want call third-party applications.
What I can confirm is that your requirements cannot be achieved in an Http Request. Because the default timeout time of the browser is about 4 minutes, different browsers may have different time, but the overall time will not exceed 5 minutes, and the browser will crash.
Blow answer is my test result.
The request timed out. The web server failed to respond within the specified time


I am sure even we get 500 error in broswer, the job still running in backend server. The options.Limits.KeepAliveTimeout = 10
configuration should be used for requests sent by the backend HttpClient, not for requests sent by the browser.
Suggestion
Through the above test results and analysis, I feel that this requirement needs to be implemented in another way.
If there is such a long http request, I recommend creating httpclient and making get and post requests on the backend. The interactive request used by the browser can be directly implemented by calling the controller method. The shorter the time, the better the interactive experience.
Take your needs as an example:
① The front-end browser sends a request, submits a task, and returns a jobId after it is submitted, and the Status
should be creating
. The jobId
and Status
can be stored in redis or other cache.
② After the task is submitted, httpclient makes an asynchronous request and waits for the operation to complete. Assuming that the task is completed after 10 minutes, the jobId can be marked as completed.
③ This is just an example, suggested. We can create a key-value pair in the front-end localStorage to store the jobId. When the jobId is not completed, we can send a request every ten seconds to ask the server whether the task is over. If finished, terminate the loop. Clear jobId information in localStorage.
How to design it needs further research. This is just an idea. Because of the limitation of the browser, we encountered the 504 error, and the app service cannot directly obtain the running time before the 504 error. At most, log can be used to record some information, but this will definitely put pressure on the server, and it will not solve the problem.
The common application scenario I encountered is the azure portal. When creating resources in it, some resources take more than half an hour. Through the above design, we have shortened the time spent on a single browser http request to a minimum.