0

I am Developing an Application in which if the Client Uploads any document(any extension), it should be synced to the server.For this i have developed the windows service which is having wcf reference. Windows service runs in the background for particular interval and checks whether the file exists on server if not transfer the document.My problem is small files having size in bytes are transfering from client to the server but the files having the size more than 16kb are failed to transfer. Even i tried with increasing the maxarrayLength to 2GB in configuaration file. But it is not transfering.

this is the code in web.config file

<system.serviceModel>
<behaviors>
  <serviceBehaviors>
    <behavior>
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
      <serviceMetadata httpGetEnabled="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="false" />
      <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
    </behavior>
  </serviceBehaviors>
</behaviors>
<bindings>
  <basicHttpBinding>
    <binding name="BasicHttpBinding_ISyncUpService" closeTimeout="00:01:00"
      openTimeout="00:01:00" receiveTimeout="00:01:00" sendTimeout="00:01:00"
      allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
      maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
      messageEncoding="Text" textEncoding="utf-8" transferMode="Streamed"
      useDefaultWebProxy="true">
      <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
        maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
      <security mode="None">
        <transport clientCredentialType="None" proxyCredentialType="None"
          realm="" />
        <message clientCredentialType="UserName" algorithmSuite="Default" />
      </security>
    </binding>
  </basicHttpBinding>
</bindings>
<client>
  <endpoint address="http://localhost/WebSetup/Services/SyncUpService.svc"
   binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ISyncUpService"
   contract="SyncUpService.ISyncUpService" name="BasicHttpBinding_ISyncUpService" />
</client>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />

I am getting the following exception

There was an error deserializing the object of type System.IO.MemoryStream. The maximum array length quota (16384) has been exceeded while reading XML data. This quota may be increased by changing the MaxArrayLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader

Thanks in advance

punra
  • 1
  • 3
  • It's all around SO. [Just an example](http://stackoverflow.com/questions/3068076/wcf-service-the-maximum-array-length-quota-16384-has-been-exceeded). Also, maybe you consider a redesign and send your file in chunks, rather than all at once. Or maybe even use a dedicated protocol for that (FTP). – Marcel N. Jul 31 '14 at 09:15

1 Answers1

0

You can try setting a bigger MaxArrayLength property on both the service and client Config file.

Sanjeev S
  • 626
  • 1
  • 8
  • 27