Browse Source

post限制

master
wxd 1 year ago
parent
commit
e0d2670175
  1. 13
      src/Shentun.WebPeis.HttpApi.Host/WebPeisHttpApiHostModule.cs

13
src/Shentun.WebPeis.HttpApi.Host/WebPeisHttpApiHostModule.cs

@ -49,6 +49,8 @@ using static Org.BouncyCastle.Math.EC.ECCurve;
using System.Security.Cryptography.X509Certificates;
using Microsoft.Extensions.Hosting.Internal;
using Microsoft.IdentityModel.Tokens;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Features;
namespace Shentun.WebPeis;
@ -310,6 +312,17 @@ public class WebPeisHttpApiHostModule : AbpModule
app.UseErrorPage();
}
//post´óСÏÞÖÆ
app.UseWhen(ct => ct.Request.Method == HttpMethods.Post,
builder => builder.UseWhen(ct => true, appBuilder =>
appBuilder.Use((ct, next) =>
{
ct.Features.Get<IHttpMaxRequestBodySizeFeature>().MaxRequestBodySize = 50 * 1024 * 1024; // 10MB
return next();
})));
app.UseCorrelationId();
app.UseStaticFiles();
//ÐéÄâĿ¼

Loading…
Cancel
Save