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

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

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

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

   1.在<system.web>      </system.web>中 添加 <httpRuntime   maxRequestLength="2097151" />  2097151 单位是字节,可以根据自己项目的长度去设置

   2.配置wcf接口的节点

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

     2.2 

 

     2.3 

             <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>

 

 

posted @ 2013-06-25 22:08  郭二的  阅读(620)  评论(0编辑  收藏  举报