我正在尝试将大字节数组从 Windows Phone 应用程序传递给wcf 服务。我已经尝试了所有可能的方法来传递大字节数组,但我无法传递它。
这是我的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 服务方法
服务1.svc.cs
public string GetDataUsingDataContract(byte[] fileByte,string fileName,string folderName)
{
}
我搜索了很多,我发现了一个类似的例子最大数组长度配额
但是听说windows phone 8不支持netTcpBinding
。我读过我们可以将2GB文件传递给 wcf 服务。如何传递最大字节数组?我被这个问题困住了。有人可以帮我解决这个问题吗?