Description
Split out from review of #37600 to keep that PR scoped to its originating UUF issue (#36039).
The Server and app configuration section of aspnetcore/mvc/models/file-uploads.md mixes two hosting-model styles within the same :::moniker range=">= aspnetcore-5.0"::: block:
Since this content is scoped to ASP.NET Core 5.0 and later — and the project templates have used minimal hosting since 6.0 — the older snippets should be updated so the section reads consistently.
Snippets to update
All in aspnetcore/mvc/models/file-uploads.md, within the >= aspnetcore-5.0 moniker block:
Suggested target style, matching the rest of the article after #37600:
var builder = WebApplication.CreateBuilder(args);
builder.Services.Configure<FormOptions>(options =>
{
// Set the limit to 256 MB
options.MultipartBodyLengthLimit = 268435456;
});
var builder = WebApplication.CreateBuilder(args);
builder.WebHost.ConfigureKestrel(options =>
{
// Handle requests up to 50 MB
options.Limits.MaxRequestBodySize = 52428800;
});
Notes
- Update the surrounding prose that references
Startup.ConfigureServices so it matches the minimal hosting snippets.
- Verify whether any of these need to remain in the older style for the
>= aspnetcore-3.0 < aspnetcore-5.0 and 2.1 moniker blocks — those blocks are separate and out of scope here.
- Bump
ms.date when making the change.
Description
Split out from review of #37600 to keep that PR scoped to its originating UUF issue (#36039).
The Server and app configuration section of
aspnetcore/mvc/models/file-uploads.mdmixes two hosting-model styles within the same:::moniker range=">= aspnetcore-5.0":::block:public void ConfigureServices(IServiceCollection services),CreateHostBuilder/Host.CreateDefaultBuilder(...).ConfigureWebHostDefaults(...), and references toStartup.ConfigureServices.builder.Services.Configure<IISServerOptions>(...),app.MapPost(...).Since this content is scoped to ASP.NET Core 5.0 and later — and the project templates have used minimal hosting since 6.0 — the older snippets should be updated so the section reads consistently.
Snippets to update
All in
aspnetcore/mvc/models/file-uploads.md, within the>= aspnetcore-5.0moniker block:services.Configure<FormOptions>wrapped inpublic void ConfigureServices(...)services.AddRazorPages(options => ...)convention example; prose referencesStartup.ConfigureServicesCreateHostBuilder/ConfigureWebHostDefaults/webBuilder.ConfigureKestrel/.UseStartup<Startup>()services.AddRazorPages(options => ...)RequestSizeLimitAttributeconvention example; prose referencesStartup.ConfigureServicesSuggested target style, matching the rest of the article after #37600:
Notes
Startup.ConfigureServicesso it matches the minimal hosting snippets.>= aspnetcore-3.0 < aspnetcore-5.0and2.1moniker blocks — those blocks are separate and out of scope here.ms.datewhen making the change.