0

I am trying to pass large byte array to wcf service from windows phone application. I have tried all possible way's to pass large byte array but I couldn't pass it.

Here is my web.config

<system.serviceModel>
<bindings>
  <basicHttpBinding>
    <!--<binding maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647" receiveTimeout="00:10:00" closeTimeout="00:10:00">
      <security mode="None" />
    </binding>-->
    <binding closeTimeout="01:30:00" 
      openTimeout="01:30:00" receiveTimeout="01:30:00" sendTimeout="01:30:00" transferMode="Streamed"
      maxBufferSize="2147483646" maxBufferPoolSize="2147483646" maxReceivedMessageSize="4294967295">
      <readerQuotas maxDepth="2147483646" maxStringContentLength="2147483646" maxArrayLength="2147483646"
        maxBytesPerRead="2147483646" maxNameTableCharCount="2147483646" /> 
      <security mode="None">             
      </security>
    </binding>    
  </basicHttpBinding>    
</bindings>   

<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"  scheme="https"/>
</protocolMapping>    
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />

I have used the max received message size i.e. 2147483646. Now I will show my

ServiceReferences.ClientConfig

<configuration>
<system.serviceModel>
<bindings>
  <basicHttpBinding>
    <binding name="BasicHttpBinding_IService1" maxBufferSize="2147483647"
      maxReceivedMessageSize="2147483647">
      <security mode="None" />
    </binding>
  </basicHttpBinding>
</bindings>
<client>
  <endpoint address="http://xxx.xx.x.xxx/WebService/Service1.svc"
    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService1"
    contract="MyService.IService1" name="BasicHttpBinding_IService1" />
</client>
</system.serviceModel>
</configuration>

I am passing following parameter to my wcf service method

Service1.svc.cs

public string GetDataUsingDataContract(byte[] fileByte,string fileName,string folderName)
{
}

I have searched a lot and I found one similar example Maximum array length quota

But I heard that windows phone 8 doesn't support netTcpBinding. I have read that we can pass 2GB file to wcf service. How can I pass max byte array? I am stuck with this problem. Can someone please help me to solve this?

Community
  • 1
  • 1

1 Answers1

0

This is quite a common exception - have a look at the following posts on msdn social:

Both seem to point to a problem with the windows 8 phone emulator. Instructions on how to work around this here: http://countofmontecito.com/2012/11/13/wcf-and-windows-phone-8/

Full documentation here: http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj684580(v=vs.105).aspx

tom redfern
  • 30,562
  • 14
  • 91
  • 126