Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Default API query timeout in asp.net core web api

Iam developing Get and Post end points in asp.net core web api and coming across timeout in specific Post end point.

The max timeout in seconds to wait for SOAPMessageV2 and RESTMessageV2 when using executeAsync method allowed is 30 seconds.

Can I get this property modified and set the revised time to avoid my endpoint with timeout issue?

I did not find any way to increase the max limit which is set to default 30 seconds.

Your suggestion or any link to with solution article will help in implementation.

Thanks

like image 544
Satyanag Avatar asked Nov 15 '25 12:11

Satyanag


1 Answers

You can change the default request timeout of 30 seconds by configuring the KestrelServerOptions for your web application. You can do that like this:

var builder = WebApplication.CreateBuilder(args);

builder.WebHost.ConfigureKestrel(options =>
{
    options.Limits.RequestHeadersTimeout = TimeSpan.FromMinutes(60);
})

This will apply the changed timeout to all requests. For more information, see the documentation on configuring the Kestrel web server.

like image 147
poke Avatar answered Nov 18 '25 21:11

poke