Wednesday, October 16, 2013

IIS error - Request entity too large


I had been working on a WCF web service lately that received the contents of a file as byte array and saved it in a database.

When calling the web-service I received the error "Request entity too large." Although the file was less than 200kb it was not able to process it.

The solution was to put the following tags inside the <system.serviceModel> tag in web.config.

<system.serviceModel>
                <bindings>
<basicHttpBinding>
<binding maxReceivedMessageSize="2097152"></binding>
</basicHttpBinding>
</bindings>
  </system.serviceModel>