0

I am getting HTTP 404 when I call an api method. The request is over 30MB in size. When I call the same api method with smaller data, the method processes successfully. The only difference is the size of the request.

Since the default request size is now ~ 30MB in ASP.NET Core 2.0 (https://github.com/aspnet/Announcements/issues/267) I tried setting the attribute RequestSizeLimit to 100MB, but I am still getting the error even with this attribute.

[HttpPost("validate")]
[RequestSizeLimit(100000000)]
public List<XmlValidationError> Validate([FromBody]XmlDocumentDto order)
{
    ...
}

I trie also setting [DisableRequestSizeLimit] on the method but it did not help.

How can the maximum request size be set?

Strangely, the 404 is also accompanied with a CORS error:

enter image description here

Martin Staufcik
  • 8,295
  • 4
  • 44
  • 63
  • Hi did you find workaround? ... yesterday I got same issue. initially I didn't use [RequestSizeLimit], only [DisableRequestSizeLimit]. That issue are reproducing on Azure App service, but not locally. – Tim Amet Jul 29 '19 at 15:20

1 Answers1

1

Setting the RequestSizeLimitAttribute was not enough. What helped was adding a web.config as described in Asp.net Core 2.0 RequestSizeLimit attribute not working.

Martin Staufcik
  • 8,295
  • 4
  • 44
  • 63