简体   繁体   中英

How can I increase timeout in .net core application. 504 http Response in .Net Core application

I've been searching for an answer to this question for a while now. I have a request that has the potential to take longer than 1 minute but it keeps timing out after 1 minute resulting in a 504 response. Since this is a .net core application, there is no web.config file to change the timeout property(at least until the application is published), therefore I have not been able to find a solution to this problem. Any help would be very appreciated

I am running on .net core 2.2 by the way.

UPDATE: It seems that I have now uncovered the reason behind the 504. It is the load-balancer that responds with a 504 if the server connection is idle for 60 seconds. The question has now become how do I keep the connection from going idle for 60 seconds during this call.

if you are running your application behind IIS you can add a web.config file to your project and then set the request timeout via the web.config file.

If you add your own web.config file, when you publish your application your file will be used and merged with some settings generated by asp.net core.

So add a web.config file to your project and modify the request timeout from there.

Out of curiosity, why you have a request which lasts as long as one minute? Are you sure about your application design? One minute is a very long time, you should try to reconsider your design. Trying to increase the request timeout on the web server side seems to be a workaround to me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM