为Iphone App发出消费WCF服务的问题 [英] Issue consuming WCF service for Iphone App‏

查看:80
本文介绍了为Iphone App发出消费WCF服务的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我用C#开发了几个WCF服务,返回类型为JSON,下面是接口结构



Hi,

I have developed couple of WCF services in C# with return type as JSON below is the structure of interface

[OperationContract]
[WebGet(UriTemplate = "/userRegestration/{Username}/{Password}/{Email}/{DeviceMecId}/{DeviceType}/", ResponseFormat = WebMessageFormat.Json)]





我无法在Iphone上使用此WCF服务,即使它在WCFClient中工作正常,请帮我解决如何使用Iphone运行WCF服务以将数据保存到服务器。 br />


我们非常感谢任何帮助。



问候,



Balwant



I am not able to consume this WCF service on Iphone even it is working fine in WCFClient, please help me out how to run WCF service with Iphone to save the data to the server.

Any help will be highly appreciated.

With Regards,

Balwant

推荐答案

JSON格式的服务,适用于iPhone应用程序。

Web.Config设置



Service in JSON format and works with IPhone App.
Web.Config Settings

<system.servicemodel>
      <services>
        <service name="AppWCFService.GreatDealService">
          <endpoint address="">
                    binding="webHttpBinding"
                    contract="AppWCFService.IGreatDealService"
                    behaviorConfiguration="Web"/>
        </endpoint></service>
      </services>
      <behaviors>
        <servicebehaviors>
          <behavior>
            <servicemetadata httpgetenabled="true" />
            <servicedebug includeexceptiondetailinfaults="false" />
          </behavior>
        </servicebehaviors>
        <endpointbehaviors>
          <behavior name="Web">
            <webhttp />
          </behavior>
        </endpointbehaviors>
      </behaviors>
      <servicehostingenvironment multiplesitebindingsenabled="false" aspnetcompatibilityenabled="true" />
    </system.servicemodel>





服务联系方式应为





Service Contact should be

[OperationContract]
        [WebInvoke(Method = "POST", UriTemplate = "/Products_Detail/{ProductID}", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        clsGreatDeal ProductDetail(String ProductID);





多数民众赞成。



Thats it.


这篇关于为Iphone App发出消费WCF服务的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆