Search code examples
c#wcffile-upload

WCF: request entity too large


I am uploading pdf of 26 MB but while uploading the pdf I am getting the following error

The remote server returned an unexpected response: (413) Request Entity Too Large.

PDF which I am trying to upload

my WCF web.config

<bindings>
  <basicHttpBinding>
    <binding maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" transferMode="Buffered"
    closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00">
      <readerQuotas maxDepth="2000000000"
      maxStringContentLength="2000000000"
      maxArrayLength="2000000000"
      maxBytesPerRead="2000000000"
      maxNameTableCharCount="2000000000" />
    </binding>
  </basicHttpBinding>
</bindings>

my web app web.config

<bindings>
  <basicHttpBinding>
    <binding name="BasicHttpBinding_IService" maxReceivedMessageSize="2147483647" />
  </basicHttpBinding>
</bindings>

<security>
  <requestFiltering>
    <requestLimits maxAllowedContentLength="2147483647" />
  </requestFiltering>
</security>

The same code is working fine in local but when I published and hosted these changes into IIS I am getting the error

The remote server returned an unexpected response: (413) Request Entity Too Large.

I saw multiple questions and answers on stackoverflow but still not able to understand what is wrong


Solution

  • I think you need to check the Service config.