I can't seem to allow a 4.3MB upload. I keep getting this error:
System.Web.HttpException (0x80004005): Maximum request length exceeded.
My web.config settings in my Web API:
<!-- maxRequestLength expresses POST buffer size in KB. This is the ASP.NET limit. -->
<httpRuntime targetFramework="4.5" maxRequestLength="20000" />
<!-- Let this be larger than maxRequestLength so we get ASP.NET error (if request too large) instead of IIS error. -->
<requestLimits maxAllowedContentLength="20480000" />
And this is the call to the API from my web project:
var response = await httpClient.SendAsync(proxyRequest);
That always returns the above error. What am I missing? I did read where maxRequestLength
needs to be the same value as maxAllowedContentLength
, but that didn't work either.
The "Default Web Site" in IIS had a config file with almost nothing in it. I added maxRequestLength="20000"
to it and it worked. My app is one of many apps under "Default Web Site."
Added this:
<system.web>
<httpRuntime targetFramework="4.5" maxRequestLength="20000" />
</system.web>
User contributions licensed under CC BY-SA 3.0