IOS调用WCF服务,WCF服务器进行上传图片

1.IOS端采用post方式请求服务器端的url地址 如:http://192.168.0.12:50000/serverce1.svc/uploadweb

IOS端的代码采用base64位编码的方式传值给WCF,WCF经过解析64位编码,而后经过流读取为byte[]类型的数据,经过读取byte[]的流将图片读取出来,最后进行保存到本地服务器

2.WCF服务端主要的是web.config的配置post

   1.在<system.web>      </system.web>中 添加 <httpRuntime   maxRequestLength="2097151" />  2097151 单位是字节,能够根据本身项目的长度去设置编码

   2.配置wcf接口的节点url

      2.1  <service behaviorConfiguration="SecondhandBehavior"   name="Secondhand">
                  <endpoint address="" behaviorConfiguration="WebHttpBindingBehavior"     bindingConfiguration="MyServiceBinding"
                          binding="webHttpBinding" contract="ISecondhand">
                  </endpoint>
             </service>spa

     2.2  server

 

     2.3  blog

             <webHttpBinding>  这个与上面红色部分的名字要同样才能够
              <binding name="MyServiceBinding" sendTimeout="00:10:00" transferMode="Streamed"           maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647" >
          <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <security mode="None" />
        </binding>
      </webHttpBinding>接口

相关文章
相关标签/搜索