แก้ time out

This commit is contained in:
kittapath 2025-10-18 21:59:27 +07:00
parent 0a42e68b28
commit 4e84e76daf
2 changed files with 28 additions and 9 deletions

View file

@ -93,6 +93,12 @@ builder.Services.AddTransient<MailService>();
builder.Services.AddTransient<CMSCandidateService>();
builder.Services.AddTransient<PermissionRepository>();
// Configure HttpClient with timeout
builder.Services.AddHttpClient("default", client =>
{
client.Timeout = TimeSpan.FromSeconds(30);
});
// Add services to the container.
builder.Services.AddControllers(options =>
{
@ -128,11 +134,11 @@ app.UseHttpsRedirection();
app.UseCors();
app.UseAuthentication();
app.UseAuthorization();
app.UseMiddleware<RequestLoggingMiddleware>();
app.UseDefaultFiles();
app.UseStaticFiles();
app.MapControllers();
app.UseMiddleware<RequestLoggingMiddleware>();
// apply migrations
await using var scope = app.Services.CreateAsyncScope();