Shuxia Ning
2025-01-07 5f51a2fe3461e1f88e75b0b6959719d25f657ef3
WebApi/HStation.WebApi.TransferFile.Core/Startup.cs
@@ -4,6 +4,7 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.AspNetCore.Server.Kestrel.Core;
using Microsoft.Extensions.DependencyInjection;
@@ -30,11 +31,23 @@
            services.Configure<KestrelServerOptions>(options =>
            {
                options.Limits.MaxRequestBodySize = int.MaxValue;
                options.Limits.MaxRequestBodySize = int.MaxValue;//之前的
                options.Limits.MaxRequestBufferSize = int.MaxValue;
                options.Limits.MaxResponseBufferSize = int.MaxValue;
            });
            services.Configure<IISServerOptions>(options =>
            {
                options.MaxRequestBodySize = int.MaxValue;
                options.MaxRequestBodySize = int.MaxValue;//之前的
                options.MaxRequestBodyBufferSize = int.MaxValue;
            });
            //解决Multipart body length limit 134217728 exceeded
            services.Configure<FormOptions>(x =>
            {
                x.ValueLengthLimit = int.MaxValue;
                x.MultipartBodyLengthLimit = int.MaxValue; // In case of multipart
                x.MultipartBoundaryLengthLimit = int.MaxValue;
                x.BufferBodyLengthLimit = int.MaxValue;
            });
            // services.AddJwt<JwtHandler>(enableGlobalAuthorize: true);