c# Asp Web API: HttpException: Maximum request length exceeded.
This might be a common question, but my situation is not so common.
I an sending a serialized image into an Asp.net Web API method and am getting this error:
System.Web.HttpException: Maximum request length exceeded.
at System.Web.HttpBufferlessInputStream.ValidateRequestEntityLength()
I searched online and found a lot of answers saying to do this in the web.config:
<system.web>
<httpRuntime maxRequestLength="40960" /> // 40MB (default)
</system.web>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="2147483648" /> // 2GB
</requestFiltering>
</security>
</system.webServer>
but when I do that all of my other API calls fail. I get:
500 - Internal server error.
and no code executes in the API calls. they all fail.
So I cannot use this setting to allow bigger files to be send into the API.
What should I do?
thanks.