Robba February 2016

How can I pass large values as parameters in ASP.NET WebApi?

I have a WebApi that allows a list of files to be sent to it. The argument is a simple list of objects that contain a name and a list of bytes. When I post small files to it, it works fine, but when I post a large file the method is called, but the parameter is null.

I assume there's a setting or something in the model binding I can change, but I can't figure out what setting to set. Especially since the method itself does get called, but only that parameter gets set to null.

Any help would be appreciated.

Answers


Sergei Kuleshov February 2016

I guess it's because you reached maxRequestLength size.

Did you try this approach?

http://www.strathweb.com/2012/09/dealing-with-large-files-in-asp-net-web-api/


Ivelin Ivanov February 2016

You could try to enlarge the max content request limit. Note that the limit is in bytes. Default IIS 7 limit I think is 30MB.

<system.webServer>
        <security>
            <requestFiltering>
                <requestLimits maxAllowedContentLength="length"/>
            </requestFiltering>
        </security>
</system.webServer>

Post Status

Asked in February 2016
Viewed 1,149 times
Voted 4
Answered 2 times

Search




Leave an answer