Last post Sep 05, 2018 08:18 AM by Brando ZWZ
Aug 15, 2018 05:33 AM|Tim.Fdo|LINK
I'm attempting to create a WebAPI2 Controller method that allows clients to upload files to the server. Based on multiple tutorials, I have successfully written the method using MultipartFormDataStreamProvider.
The issue I am having is that this fails with a HTTP 400.0 error message "ASP.NET detected invalid characters in the URL." if the file's size exceeds 2GB.
How can I allow the upload of files up to 3/4 GB?
Aug 16, 2018 08:09 AM|Brando ZWZ|LINK
As far as I know, this is a limitation of IIS. In IIS6, the limitation is 2GB. In IIS7/7.5, the limitation is 4GB. So, you may check the version of IIS, then reset the max value in IIS.
But, In Visual Studio, we just set the max size is 2GB at points ‘maxRequestLength’ and ‘maxAllowedContentLength’ in web.config.
Because the 2 points are Int32 option, which it is not over with max value of Int32. You could refer to link below:
httpRuntime Element (ASP.NET Settings Schema) (maxRequestLength)
Aug 19, 2018 10:57 PM|bruce (sqlwork.com)|LINK
it will depend on which webapi you are using. but you need to turn off buffering, and stream the request stream.
Aug 20, 2018 12:57 AM|Tim.Fdo|LINK
I am using WebAPI2 on .Net 4.7 (C#).
By turning off buffering, do you mean at the client end or at the server end?
Would you be able to point me to some resources on how to achieve that?
Sep 05, 2018 08:18 AM|Brando ZWZ|LINK
According to your description, I suggest you could try to use GetBufferlessInputStream to achieve your requirement.
More details, you could refer to below code sample: