-
Notifications
You must be signed in to change notification settings - Fork 10.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multipart body length limit 16384 exceeded in NET CORE #50252
Comments
Maybe it's related to this TODO comment:
|
Do you mean like this var reader = new MultipartReader(boundary, contentStream);
reader.HeadersLengthLimit = 32768; // Set to a higher value, if necessary
reader.BodyLengthLimit = 1048576; // Set to a higher value for the body, e.g., 1 MB |
Its still not working btw |
Yes, because in the
|
Is there a boundary and headers at the start of that XML? There should be. It's also possible that you're not passing the correct boundary value to the reader. E.g. the boundary likely has quotes around it that you need to remove. |
|
No, the body should look like this:
MultipartReader discards anything before the first boundary, but would throw if it's too long. |
Still getting the same error |
What I am trying to do
I'm trying to access the API in my project (NET Core 6 WebApi) to get data from the response for the project purpose. The API response that I will access is XML data which consists of some data such as title, description, creation date, and also photo data in it.
Here's how I access the API using IHttpClientFactory in mycontroller:
However, when I try to read section from the MultipartReader in code:
I got an Error like this
Things i've tried:
I've tried several ways to overcome this, one of which is to increase the MultipartBodyLengthLimit in Program.cs
and I still get the same error
Postman response
In postman, it will return XML data and provides information with content-type multipart/mixed.
Here is the response result in postman:
How to solve this problem?
The text was updated successfully, but these errors were encountered: