none
413 Request Entity Too Large?? RRS feed

  • Question

  • I've spent 3 days now trying to determine why my Silverlight 5 application was getting a generic "Not Found" error message when calling my Web Service (currently this is all in Debug environment using LocalHost).

    So I've searched many many sites looking for answers and it was suggested that I install Fiddler4 (for .NET 4.0) to get more information because apparently VS 2012 is seriously lacking in this area (even when the solution's projects are all local and I'm using LocalHost) when it comes to returning useful error information.

    Anyway, with fiddler installed, I monitor my Silverlight 5 calls to my web service and fiddler shows a response header of "413 Request Entity Too Large".  So I proceed to search for answers around this error and many suggest I need to increase these entries in my web.config:

          <webHttpBinding>
            <binding maxBufferPoolSize ="2147483647" maxBufferSize ="2147483647" maxReceivedMessageSize ="2147483647" />
          </webHttpBinding>

    and this in my ServiceReference.ClientConfig for each custom binding

              <httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />

    So I checked for these entries in my config files and I already have them.  So now I've run out of suggestions/options and I started to manually pull apart my object and it's contained objects that are being passed into my Web Service.  

    So starts the long labor intensive process of setting properties and contained object properties to Nothing until I can successfully get the web service call working.  My passed in object isn't too complex, it's a object with a few List Collections of objects and DictionaryCollections of objects ... the DictionaryCollections are set to nothing prior to calling the Web Service because I know web services can return DictionaryCollections but they can't be passed back in.

    So my passed in object hiearchy is about 4 levels deep Object1 --> List(of Object2) --> Object2 --> List(of Object3) --> Object3 --> Object4 ... the passed in object is about 148,586 bytes (145KB).

    I'm guessing there is some limit to how much data I can pass into a web service call ... if so, what/where/how can I increase this value ... or is it not possible?

    Rob 

    Tuesday, January 7, 2014 1:15 AM

Answers

  • Hi,

    When we meet the "413 Request Entity Too Large" error, we should first set the maxReceivedMessageSize as you did, but we should also do some other settings such as timeout and readerQuotas, please try to check the following binding cofig:

    <bindings>
      <webHttpBinding>
        <binding name="MywebHttpBinding"
            closeTimeout="00:50:00" openTimeout="00:50:00" receiveTimeout="00:50:00"
            sendTimeout="00:50:00" maxBufferSize="2147483647"
            maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
          <readerQuotas maxDepth="64" maxStringContentLength="2147483647" maxArrayLength="2147483647"
              maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"  />
         </binding>
      </webHttpBinding>
    </bindings>


    After that please do not forget to apply this binding configure to the endpoint, it should be something like below :

    <endpoint address="http://myservice" binding="webHttpBinding"
    bindingConfiguration="MywebHttpBinding" contract="IMyServiceContract" />

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.



    Wednesday, January 8, 2014 3:16 AM
    Moderator
  • Solved it by adding the following to my Web.config:

    Under CustomBinding and my specific web service binding...

              <binaryMessageEncoding maxWritePoolSize ="2147483647" maxSessionSize ="2147483647" maxReadPoolSize ="2147483647" />
              <httpTransport maxBufferPoolSize ="2147483647" maxBufferSize ="2147483647" maxReceivedMessageSize ="2147483647" />
    

    And for bindings

          <wsHttpBinding>
            <binding name="wsBinding" maxBufferPoolSize ="2147483647" maxReceivedMessageSize ="2147483647">
              <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
            </binding>
          </wsHttpBinding>
          <webHttpBinding>
            <binding maxBufferPoolSize ="2147483647" maxBufferSize ="2147483647" maxReceivedMessageSize ="2147483647" />
          </webHttpBinding>
    

    Any particular reason why Microsoft (VS 2012) doesn't make these entries default in the their code generators?  Seems to me Microsoft got the defaults backwards where most cases we're going to want this values and NOT the other way around.

    Rob


    Thursday, January 16, 2014 9:05 PM

All replies

  • Hi,

    When we meet the "413 Request Entity Too Large" error, we should first set the maxReceivedMessageSize as you did, but we should also do some other settings such as timeout and readerQuotas, please try to check the following binding cofig:

    <bindings>
      <webHttpBinding>
        <binding name="MywebHttpBinding"
            closeTimeout="00:50:00" openTimeout="00:50:00" receiveTimeout="00:50:00"
            sendTimeout="00:50:00" maxBufferSize="2147483647"
            maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
          <readerQuotas maxDepth="64" maxStringContentLength="2147483647" maxArrayLength="2147483647"
              maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"  />
         </binding>
      </webHttpBinding>
    </bindings>


    After that please do not forget to apply this binding configure to the endpoint, it should be something like below :

    <endpoint address="http://myservice" binding="webHttpBinding"
    bindingConfiguration="MywebHttpBinding" contract="IMyServiceContract" />

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.



    Wednesday, January 8, 2014 3:16 AM
    Moderator
  • Solved it by adding the following to my Web.config:

    Under CustomBinding and my specific web service binding...

              <binaryMessageEncoding maxWritePoolSize ="2147483647" maxSessionSize ="2147483647" maxReadPoolSize ="2147483647" />
              <httpTransport maxBufferPoolSize ="2147483647" maxBufferSize ="2147483647" maxReceivedMessageSize ="2147483647" />
    

    And for bindings

          <wsHttpBinding>
            <binding name="wsBinding" maxBufferPoolSize ="2147483647" maxReceivedMessageSize ="2147483647">
              <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
            </binding>
          </wsHttpBinding>
          <webHttpBinding>
            <binding maxBufferPoolSize ="2147483647" maxBufferSize ="2147483647" maxReceivedMessageSize ="2147483647" />
          </webHttpBinding>
    

    Any particular reason why Microsoft (VS 2012) doesn't make these entries default in the their code generators?  Seems to me Microsoft got the defaults backwards where most cases we're going to want this values and NOT the other way around.

    Rob


    Thursday, January 16, 2014 9:05 PM
  • Thanks (:

    You solved my problem!

    Thursday, October 22, 2015 12:24 PM