0
votes

I have a ASP.NET Core 2.1 WebAPI project hosted in Azure as a Windows App Service in Premium Tier.

This API has an endpoint that accepts a POST request with a JSON payload (Content-Tye=application/json).

When I call this API(from Postman or from C# console app using HttpClient) and pass a JSON payload of 100KB then it gives error "an existing connection was forcibly closed by the remote host". But when I call this same API with a smaller JSON payload like 20KB then it succeeds.

So is there any settings to increase request length in Azure WebApp?

1

1 Answers

0
votes

Starting in ASP.NET Core 2.0.0, both Kestrel and HttpSys will be enforcing a a 30MB (~28.6 MiB) max request body size limit.

If the request body size exceeds the configured max request body size limit, the call to Request.Body.ReadAsync will throw an IOException. If this exception is uncaught, Kestrel will respond with a 413 Payload Too Large response and HttpSys will respond with a generic 500 Internal Server Error response.

This limit can be changed either globally or on a per-request basis, and is disabled for Kestrel running behind IIS where the normal web.config limit still applies.

From https://github.com/aspnet/Announcements/issues/267