(413) Request Entity Too Large Error

5 years ago
Hi,

I am consuming Nop.Plugin.Misc.WebServices and added operation (method) to upload files to product using method ProductPictureAdd.

Everything works well for file size less than 45KB but if upload more than 45 KB which is obvious for product picture it throws above error. I did google and found that I need to allow WCF to handle larger size but still NO LUCK.

Ref :
http://stackoverflow.com/questions/10122957/iis7-413-request-entity-too-large-uploadreadaheadsize
http://blog.bennymichielsen.be/2014/03/22/wcf-https-and-request-entity-too-large/
http://www.iis.net/learn/manage/managing-your-configuration-settings/editing-collections-with-configuration-editor

Can anyone help me how could I fixed that.

1. I did modify client web.config to have maxReceivedMessageSize="2147483647" No LUCK

<system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_INopService" maxReceivedMessageSize="2147483647" maxBufferPoolSize="52428800" maxBufferSize="2147483647">
          <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="16384"
            maxBytesPerRead="20000" maxNameTableCharCount="16384" ></readerQuotas>
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://localhost/Plugins/Misc.WebServices/Remote/NopService.svc"
        binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_INopService"
        contract="PhotoSavingsService.INopService" name="BasicHttpBinding_INopService" />
    </client>
  </system.serviceModel>

2. I also change NopCommerce - root/web.config to have uploadReadAheadSize="2147483647" No LUCK

<location path="localhost" allowOverride="true">
    <system.webServer>
      <asp />
      <serverRuntime uploadReadAheadSize="2147483647" />
    </system.webServer>
  </location>


3. I also tried to modify Step-1 Code in Plugin.Misc.WebService/Remote/web.config

Can any one please help me to get rid of this error.

-Thanks,
Deep Patel.
5 years ago
Nop Team,

Please help !! Any one has solution ?? I am struggling to upload images via Web Service since last 3 days.

Any help is appreciated in advance.
5 years ago
Hi,

I just found solution and make it working. I am using NopCommerce 3.40 and only changed one thing in plugin/remote/web.config

I need to set "2147483647" to basicHTTPBinding Node where it has maxReceivedMessageSize = 65536. Please see updated changes in web.config file for service plugin.

We don't need to change anything apart from that. I am using IIS 8.5

<basicHttpBinding>
        <binding name="HttpBigMessage"
             receiveTimeout="00:10:00"
             sendTimeout="00:10:00"
             maxReceivedMessageSize="2147483647" >
          <security mode="None" />
        </binding>
      </basicHttpBinding>

-Thanks,
Deep Patel