WCF传递最大字节数组

时间:2013-09-26 07:13:14

标签: wcf windows-phone-8 wcf-binding

我正在尝试从Windows Phone应用程序将大字节数组传递给 wcf service 。我已经尝试了所有可能的方法来传递大字节数组但我无法通过它。

这是我的 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" />

我使用了最大收到的邮件大小,即2147483646。现在我将展示我的

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>

我将以下参数传递给我的wcf服务方法

Service1.svc.cs

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

我搜索了很多,我发现了一个类似的例子Maximum array length quota

但我听说Windows Phone 8不支持netTcpBinding。我已经读过,我们可以将 2GB 文件传递给wcf服务。我怎样才能传递最大字节数组?我遇到了这个问题。有人可以帮我解决这个问题吗?