(ksoap2)android到wcf HTTP请求失败,HTTP状态:413

时间:2014-10-27 07:54:03

标签: android wcf ksoap2

我想将jpg文件从android发送到wcf服务器。

我使用base64。任何人都知道更好的主意,请让我知道。

无论如何,当我调试它时,HTTP请求失败,HTTP状态:413

请帮帮我。

这是我的App.config

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
 </startup>
 <system.serviceModel>
<bindings>
  <basicHttpBinding>
    <binding name="BasicHttpBinding_IProductService" maxBufferSize="2147483647" maxBufferPoolSize="2147483647"
             maxReceivedMessageSize="2147483647" messageEncoding="Mtom" >
      <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647"
                    maxNameTableCharCount="2147483647"/>
    </binding>
  </basicHttpBinding>
</bindings>
<client>
  <endpoint address="http://182.162.136.28:8733/ProductService"
    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IProductService" contract="MyService.IProductService" name="BasicHttpBinding_IProductService" />
</client>
  </system.serviceModel>
</configuration>

1 个答案:

答案 0 :(得分:0)

HTTP状态:413表示您发送的请求太大,wcf服务器无法接受。

您可能需要更改wcf端的设置。 像这样:

<system.serviceModel> <bindings> <basicHttpBinding> <binding maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" transferMode="Streamed" > <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/> <security mode="None"> </security> </binding> </basicHttpBinding> </bindings>