1

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:

  • Removed the binding name
  • Even gave maxReceivedMessageSize is 5MB.

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

Surendhar
  • 307
  • 2
  • 3
  • 12
  • How big is your data? If it is a raw screenshot it is possible that it is larger than 5mb. You should convert it to JPG or PNG before trying to send it over the network, and possibly compress it before sending it. – Ron Beyer Feb 26 '18 at 13:17
  • @RonBeyer, I tried to save this file it was only 180 KB, also compressed this image in 90% quality, even I tried with 75% quality. – Surendhar Feb 26 '18 at 13:23
  • What's your client side config looks like? Is it the same ? – Dhawalk Feb 26 '18 at 17:05
  • Yes, **maxReceivedMessageSize="2000000"** – Surendhar Feb 27 '18 at 06:51

1 Answers1

1

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>

Jorge Del Conde
  • 265
  • 1
  • 4