Added max file size upload option. Switched from stream upload to multipart form content file upload

This commit is contained in:
2025-03-07 13:31:30 +01:00
parent 9fb1667bf0
commit f23320eb1c
5 changed files with 36 additions and 3 deletions

View File

@@ -71,6 +71,7 @@ public class Startup
await CreateWebApplicationBuilder();
await ConfigureKestrel();
await RegisterAppConfiguration();
await RegisterLogging();
await RegisterBase();
@@ -183,6 +184,20 @@ public class Startup
return Task.CompletedTask;
}
private Task ConfigureKestrel()
{
WebApplicationBuilder.WebHost.ConfigureKestrel(kestrelOptions =>
{
var maxUploadInBytes = ByteConverter
.FromMegaBytes(Configuration.Kestrel.UploadLimit)
.Bytes;
kestrelOptions.Limits.MaxRequestBodySize = maxUploadInBytes;
});
return Task.CompletedTask;
}
#endregion
#region Plugin Loading