Surendhar
Surendhar

Reputation: 327

c# - The remote server returned an unexpected response: (413) Request Entity Too Large

I am trying to create an windows application which will capture the screen periodically and convert the image as binary and send it through WCF service. WCF save this value in SQL database.

I cannot able to send through the WCF Service it throwing the error. Other than the binary image, I send the user name only.

I checked the total service size is about 200kb, also in web.config file I gave allowed size of maxReceivedMessageSize="2000000"(2MB).

<bindings>
        <basicHttpBinding>
            <binding name="sslBinding" maxReceivedMessageSize="2000000" maxBufferSize="2000000">
                <readerQuotas maxArrayLength="2000000" maxStringContentLength="2000000" />
                <security mode="Transport" >
                  <transport clientCredentialType="None" proxyCredentialType="None" realm=""/>
                </security>
            </binding>
        </basicHttpBinding>
    </bindings>

Tried:

I don't want to change basicHttpBinding to webHttpBinding, because other services are running in the same application.

I have referred the questions 30890220 and 44234761

Upvotes: 1

Views: 678

Answers (1)

Jorge Del Conde
Jorge Del Conde

Reputation: 361

Try using this for your binding:

      <basicHttpBinding>
    <binding maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text">
      <readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
    </binding>
  </basicHttpBinding>

I know you already modified maxReceivedMessageSize, so with the above you're also tampering with readerQuotas.

You can also try increasing the uploadReadAheadSize in IIS:

<location path="THENAMEOFTHESITEYOUHAVE" overrideMode="Allow">
<system.webServer>
    <asp />
    <serverRuntime uploadReadAheadSize="2147483647" />
</system.webServer>

Upvotes: 1

Related Questions