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

7 years ago
We have written a console application to upload images in bulk (file system) and eventhough we changed the config file we get this error. The size of the image we are trying to upload is 6MB (each).

I can upload the image through the administrator part of NopCommerce after making changes to web.config file. However not with the application we developed.

I appreciate any help to resolve this error.

Thanks in advance.
7 years ago
ppushpala wrote:
We have written a console application to upload images in bulk (file system) and eventhough we changed the config file we get this error. The size of the image we are trying to upload is 6MB (each).

I can upload the image through the administrator part of NopCommerce after making changes to web.config file. However not with the application we developed.

I appreciate any help to resolve this error.

Thanks in advance.


Have you tried setting the MaxRequestLength in web.config? http://msdn.microsoft.com/en-us/library/e1f13641(v=vs.71).aspx :)
7 years ago
Ppushpala and me are developing a console application bulk image upload function together.  We have attempted to apply the maxRequestLength parameter in the app.config file of our console application.  Our console application uses the webservices API (Nop.Plugin.Misc.WebServices) to call the pictureservice functions in nop.  The console application contains an app.config and a web.config file (which I believe was generated when building app from the webservices).  The web.config file contained a defined binding name "HttpBigMessage" which I have attempted to reference in my app.config (as shown below).  We have not modified the Nop.web web.config.  However, after building my nopCommerce install and the console app with the modified .config files it is still failing to allow me to upload large files (2 - 6 MB) as needed.  Any advise would be greatly appreciated.


<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <startup>
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
    </startup>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="HttpBigMessage" receiveTimeout="05:10:00"
             sendTimeout="05:10:00"
             maxReceivedMessageSize="2147483647">
        <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
          maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://localhost:59633/plugins/misc.webservices/remote/NopService.svc"
          binding="basicHttpBinding" bindingConfiguration="HttpBigMessage"
          contract="INopService" name="HttpBigMessage" />
    </client>
  </system.serviceModel>
  <system.web>
    <httpRuntime targetFramework="4.5" maxRequestLength="2147483647"/>
  </system.web>
</configuration>

Again, thanks in advance.
7 years ago
KimS wrote:
Ppushpala and me are developing a console application bulk image upload function together.  We have attempted to apply the maxRequestLength parameter in the app.config file of our console application.  Our console application uses the webservices API (Nop.Plugin.Misc.WebServices) to call the pictureservice functions in nop.  The console application contains an app.config and a web.config file (which I believe was generated when building app from the webservices).  The web.config file contained a defined binding name "HttpBigMessage" which I have attempted to reference in my app.config (as shown below).  We have not modified the Nop.web web.config.  However, after building my nopCommerce install and the console app with the modified .config files it is still failing to allow me to upload large files (2 - 6 MB) as needed.  Any advise would be greatly appreciated.


<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <startup>
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
    </startup>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="HttpBigMessage" receiveTimeout="05:10:00"
             sendTimeout="05:10:00"
             maxReceivedMessageSize="2147483647">
        <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
          maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://localhost:59633/plugins/misc.webservices/remote/NopService.svc"
          binding="basicHttpBinding" bindingConfiguration="HttpBigMessage"
          contract="INopService" name="HttpBigMessage" />
    </client>
  </system.serviceModel>
  <system.web>
    <httpRuntime targetFramework="4.5" maxRequestLength="2147483647"/>
  </system.web>
</configuration>

Again, thanks in advance.


It seems like the webservice is limiting the upload. Have you referred to other forum? Like this one: http://social.msdn.microsoft.com/Forums/vstudio/en-US/5302ef38-096e-46a0-a345-496e56dee613/413-request-entity-too-large-only-over-ssl
7 years ago
wooncherk, thank you for your suggestions.  I modified the IIS configuration as the article you reference suggested however I am still receiving the 413 error.  As the article link below suggests I believe the problem is not with the IIS settings but the WCF tranmission settings.  I don't believe this is an IIS issue because I successfully modified the administration interface's web.config to allow large image uploads through the built in product add function.  I believe the .config file utilized by the WCF functions needs to modified.  However I am not sure what .config file's settings is being accessed when I am utilizing the API functions of the web services plugin.  If anyone can specify which .config I need to modify in order to allow the large image uploads for the web services plugin, I think I can rectify this error.  Of course if anyone can specify the settings that are needed to be modified I would appreciate the details.

http://stackoverflow.com/questions/10122957/iis7-413-request-entity-too-large-uploadreadaheadsize

Thanks again in advance,
Kim
7 years ago
I would greatly appreciate if anyone can specify which .config I need to modify the setting of in order to allow large image uploads for the web services (API) plugin.  Or can anyone describe how I may trace which config file is controlling the settings of the web services (API) plugin?  We are using nopCommerce 3.0.  I am really stumped and frustrated with the 413 error I am receiving when attempting to upload large images utilizing the web services API console application we developed.

Thanks in advance,
Kim
6 years ago
Hello Kim.

Not sure if you resolved this problem or not.

I was having the exact same problem and tried for a couple of days to figure it out.  My solution was to add the  maxReceivedMessageSize="2147483647" to the App.config file of my client consuming program.

That solved the problem for me.

Here is the contents of my App.config file:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <startup>
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
    </startup>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="BasicHttpBinding_INopService" maxReceivedMessageSize="2147483647" />
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://www.lakesideos.com/Plugins/Misc.WebServices/Remote/NopService.svc"
                binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_INopService"
                contract="LakesideServiceReference.INopService" name="BasicHttpBinding_INopService" />
        </client>
    </system.serviceModel>
</configuration>


Hope this helps.

Tony
6 years ago
Hello,

I am also getting same error. I am struggling since last 2 days but no hope. My client application is small website. I am trying to upload Images using small website using webservice calls.

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.
6 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
3 years ago
Hi,
Do you know the location of web.config I have to modify for the nop version 3.7.6.0

Thanks,
Shibin