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

  • Question

  • I am writing a client to upload an image to a Java SOAP service using a WCF client. The upload happens as a hex string-encoded byte array.

    When uploading an image of 900 KB, I'm getting the error:

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

    I tried increasing the maxReceivedMessageSize and other relevant properties in my client's config:

    <bindings>
    <basicHttpBinding>
     <binding name="BasicHttpBinding" sendTimeout="00:25:00" openTimeout="00:25:00" receiveTimeout="00:25:00" closeTimeout="00:25:00" maxBufferPoolSize="2147483647" maxBufferSize="2147483647"
      maxReceivedMessageSize="2147483647">
      <readerQuotas maxDepth="128" maxStringContentLength="2147483647"
       maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
     </binding>
    </basicHttpBinding>
    </bindings>
    
    <system.webServer>
     <modules runAllManagedModulesForAllRequests="true"/>
       <security>
         <requestFiltering>
           <requestLimits maxAllowedContentLength="2147483647"/>
         </requestFiltering>
       </security>   
     <directoryBrowse enabled="true"/>
    </system.webServer>

    But this didn't resolve the issue.

    MemoryStream ms = new MemoryStream();
    WriteableBitmap wbitmp = new WriteableBitmap((BitmapImage)image1.Source);
    wbitmp.SaveJpeg(ms, 400, 400, 0, 100);
    bytearray = ms.ToArray();
    
    string hexString = BitConverter.ToString(bytearray);

    Here I am returning file to Java Soap Service: See my HEX String and XML Document:

    StringBuilder stb1 = new StringBuilder();
    stb1.Append("<row>");
    stb1.Append("<document>");
    stb1.Append(hexString).Replace("-", string.Empty);
    stb1.Append("</document>");
    stb1.Append("</row>");

    My HexString looks like:

    FFD8FFE000104A46494600010101006000600000FFDB004300010
    1010101010101010101010101010101010101010101010.........

    Any help would be greatly appreciated!1

    Thanks!!

    Monday, January 12, 2015 7:27 AM

Answers

  • Mysterious Microsoft it is!!

    I removed 

    name="BasicHttpBinding" 

    from <bindings> element in "web.config" and all is well.

    my error is solved.

    Hohohohoho!!

    • Marked as answer by viraj.shah Monday, January 12, 2015 10:21 AM
    Monday, January 12, 2015 9:12 AM

All replies

  • Mysterious Microsoft it is!!

    I removed 

    name="BasicHttpBinding" 

    from <bindings> element in "web.config" and all is well.

    my error is solved.

    Hohohohoho!!

    • Marked as answer by viraj.shah Monday, January 12, 2015 10:21 AM
    Monday, January 12, 2015 9:12 AM
  • Hi viraj.shah,

    Well Done!

    I am very glad that you have solved your problem by yourself.

    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.

    Tuesday, January 13, 2015 2:20 AM
    Moderator
  • @Amy Peng, Ok, I shall do it whenever I get time!!

    Thanks.

    Tuesday, January 13, 2015 5:01 AM