Added configurable request body size limit

This commit is contained in:
2026-02-12 18:32:17 +01:00
parent 047526dc3c
commit 41fd8a067e
2 changed files with 9 additions and 0 deletions

View File

@@ -35,6 +35,12 @@ EmbeddingSearchOptions configuration = configurationSection.Get<EmbeddingSearchO
builder.Services.Configure<EmbeddingSearchOptions>(configurationSection); builder.Services.Configure<EmbeddingSearchOptions>(configurationSection);
builder.Services.Configure<ApiKeyOptions>(configurationSection); builder.Services.Configure<ApiKeyOptions>(configurationSection);
// Configure Kestrel
builder.WebHost.ConfigureKestrel(options =>
{
options.Limits.MaxRequestBodySize = configuration.MaxRequestBodySize ?? 50 * 1024 * 1024;
});
// Migrate database // Migrate database
var helper = new SQLHelper(new MySql.Data.MySqlClient.MySqlConnection(configuration.ConnectionStrings.SQL), configuration.ConnectionStrings.SQL); var helper = new SQLHelper(new MySql.Data.MySqlClient.MySqlConnection(configuration.ConnectionStrings.SQL), configuration.ConnectionStrings.SQL);
DatabaseMigrations.Migrate(helper); DatabaseMigrations.Migrate(helper);

View File

@@ -16,5 +16,8 @@
"Application": "Embeddingsearch.Server" "Application": "Embeddingsearch.Server"
} }
}, },
"Embeddingsearch": {
"MaxRequestBodySize": 524288000
},
"AllowedHosts": "*" "AllowedHosts": "*"
} }