ningshuxia
2025-04-01 ef2ed31abaaec51c035c53d7596e788af4beb40a
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);