Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

InvalidDataException: Form key or value length limit 2048 exceeded. #7132

Closed
omnoms opened this issue Dec 14, 2017 · 5 comments
Closed

InvalidDataException: Form key or value length limit 2048 exceeded. #7132

omnoms opened this issue Dec 14, 2017 · 5 comments
Labels

Comments

@omnoms
Copy link

omnoms commented Dec 14, 2017

This is despite implementing the attribute that is mentioned in #481 and trying to post a file to the method.

        [RequestSizeLimit(2147483648)]
        [HttpPost("UploadFiles")]
        public async Task<IActionResult> Post(IFormFile file)

What else/wherelse can I configure this to allow larger files?

Steps to reproduce:

  • Create a new ASP.NET Core 2 Webapi project (Core 2.0.3 SDK)
  • Modify the POST method in the valuescontroller.cs to match the above.
  • Use Postman or your favourite tool to create a POST request with a file in it.

image

@mkArtakMSFT
Copy link
Member

Hi @omnoms. As you can see from the thread you've pointed to, we've added a new RequestFormLimitsAttribute attribute to configure the size limitation. As that's not released yet, you can look into how it used to be done in one of our samples, available here. You can use the removed attribute code (from the sample) and use it to configure the limit. Hope this helps.

@omnoms
Copy link
Author

omnoms commented Dec 15, 2017

I've now implemented the attribute, but the it doesn't really map the form-data sent to the method.

I.e. I'm sending 2 files in the "files" key as form-data, it hits the method, but the files are not mapped properly to List files... I get gibberish and a new exception...

I'll have to do more testing once I have more time.

@mkArtakMSFT
Copy link
Member

@omnoms, do you have any updates regarding this?

@mkArtakMSFT
Copy link
Member

@omnoms, please let us know if you are still facing this issue. If so, please also provide a sample project to repro it.

@omnoms
Copy link
Author

omnoms commented Jan 4, 2018

I'm currently on parental leave and not much time to do further testing. So it's fine to close this, however the issue prevails with the standard settings. The workaround will have to do for now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants