none
The remote server returned an unexpected response: (413) Request Entity Too Large RRS feed

  • Question

  • Hi,

    I have WCF service it is returning (413) Request Entity Too Large exception. 

    I am trying to send a list of objects containing 161 objects. How can I solve this?? 

    I changed my web.config to solve this but had no luck may be I a missing something.. below is the content of my config file.

    <system.web>
        <compilation debug="true" targetFramework="4.5" />
        <httpRuntime targetFramework="4.5" maxRequestLength="2147483647"/>    
      </system.web>
      <system.serviceModel>
        <behaviors>
          <serviceBehaviors>
            <behavior>
              <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
              <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
              <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
              <serviceDebug includeExceptionDetailInFaults="true"/>
            </behavior>
          </serviceBehaviors>
        </behaviors>
        <protocolMapping>
          <add binding="basicHttpsBinding" bindingConfiguration="largeBinding" scheme="https" />      
        </protocolMapping>
        <bindings>
          <basicHttpBinding>
            <binding name="largeBinding" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
              <security mode="None"/>
            </binding>
          </basicHttpBinding>
        </bindings>
        <serviceHostingEnvironment  aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
      </system.serviceModel>


    Rohit

    Friday, December 6, 2013 8:01 AM

Answers

  • Probably you also need to set readerQuotas in your config.
    Eg:
    <bindings>
          <basicHttpBinding>
            <binding name="largeBinding" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
    <readerQuotas ... />
              <security mode="None"/>
            </binding>
          </basicHttpBinding>
        </bindings>

    You can fill the below values in readerQuotas:
    <readerQuotas 
        maxArrayLength="Integer"
            maxBytesPerRead="Integer"
            maxDepth="Integer"
            maxNameTableCharCount="Integer"
        maxStringContentLength=="Integer" />

    Please refer http://msdn.microsoft.com/en-us/library/ms731325(v=vs.110).aspx for more details.

    See if that helps.


    Kunal G

    Friday, December 6, 2013 9:39 AM
  • Hi,

    I saw that you have set the following:

    <basicHttpBinding>
             <binding name="largeBinding" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
               <security mode="None"/>
             </binding>
    </basicHttpBinding>

    But have you applied the bindings to the endpoint? If we do not use the bindingConfiguration in the endpoint, then those configure will not work.

    So please first try to refer to the following:

    <bindings>
        <basicHttpBinding>
            <binding name="largeBinding" allowCookies="true"
                     maxReceivedMessageSize="2147483647" 
                     maxBufferSize="2147483647"
                     maxBufferPoolSize="2147483647">
                <readerQuotas maxDepth="32" 
                     maxArrayLength="2147483647"
                     maxStringContentLength="2147483647"/>
                <security mode="None"/>
    </binding>
    </basicHttpBinding> </bindings>

    Then please apply it to the endpoint configuration as following:

     <endpoint name="basicHttpBinding"
                     address=" "
                      binding="basicHttpBinding"
                      bindingConfiguration="largeBinding"
                      contract="YourContract">
      </endpoint>
    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.

    Monday, December 9, 2013 6:10 AM
    Moderator

All replies

  • Probably you also need to set readerQuotas in your config.
    Eg:
    <bindings>
          <basicHttpBinding>
            <binding name="largeBinding" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
    <readerQuotas ... />
              <security mode="None"/>
            </binding>
          </basicHttpBinding>
        </bindings>

    You can fill the below values in readerQuotas:
    <readerQuotas 
        maxArrayLength="Integer"
            maxBytesPerRead="Integer"
            maxDepth="Integer"
            maxNameTableCharCount="Integer"
        maxStringContentLength=="Integer" />

    Please refer http://msdn.microsoft.com/en-us/library/ms731325(v=vs.110).aspx for more details.

    See if that helps.


    Kunal G

    Friday, December 6, 2013 9:39 AM
  • No, it did not solve the problem.


    Rohit

    Friday, December 6, 2013 10:52 AM
  • Hi,

    I saw that you have set the following:

    <basicHttpBinding>
             <binding name="largeBinding" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
               <security mode="None"/>
             </binding>
    </basicHttpBinding>

    But have you applied the bindings to the endpoint? If we do not use the bindingConfiguration in the endpoint, then those configure will not work.

    So please first try to refer to the following:

    <bindings>
        <basicHttpBinding>
            <binding name="largeBinding" allowCookies="true"
                     maxReceivedMessageSize="2147483647" 
                     maxBufferSize="2147483647"
                     maxBufferPoolSize="2147483647">
                <readerQuotas maxDepth="32" 
                     maxArrayLength="2147483647"
                     maxStringContentLength="2147483647"/>
                <security mode="None"/>
    </binding>
    </basicHttpBinding> </bindings>

    Then please apply it to the endpoint configuration as following:

     <endpoint name="basicHttpBinding"
                     address=" "
                      binding="basicHttpBinding"
                      bindingConfiguration="largeBinding"
                      contract="YourContract">
      </endpoint>
    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.

    Monday, December 9, 2013 6:10 AM
    Moderator