启用服务 WCF 使用S. JSON
我创造了服务 wcf. 我使用的时候很棒 in .net, 通过作为Web服务添加。 但我希望他使用该应用程序 for iPhone 作为一个挑战 JSON. 用于测试,我用它 .net 和 JSON, 但它不起作用。
我知道之前问过这样的问题,我正在寻找他,我找不到自己的解决方案。
我的配置:
接口代码:
Myservice.cs 代码:
我想使用格式调用一种方法 url, 例如 :
http://example.com/MyService.svc/test
</system.servicemodel>
我知道之前问过这样的问题,我正在寻找他,我找不到自己的解决方案。
我的配置:
<system.servicemodel>
<behaviors>
<servicebehaviors>
<behavior name="servicebehavior">
<servicemetadata httpsgetenabled="true"></servicemetadata>
</behavior>
</servicebehaviors>
<endpointbehaviors>
<behavior name="endpointBehavior">
<enablewebscript></enablewebscript>
<webhttp defaultbodystyle="Wrapped" defaultoutgoingresponseformat="Json"></webhttp>
</behavior>
</endpointbehaviors>
</behaviors>
<servicehostingenvironment aspnetcompatibilityenabled="true"></servicehostingenvironment>
<services>
<service behaviorconfiguration="servicebehavior" name="MyService">
<endpoint address="" behaviorconfiguration="endpointBehavior" binding="webHttpBinding" contract="IMyService"></endpoint>
</service>
</services>
接口代码:
[ServiceContract]
public interface IGolfPyramidService
{
[WebInvoke/UriTemplate = "/Test", Method = "POST", ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedRequest/]
[OperationContract]
string Test//;
}
Myservice.cs 代码:
[AspNetCompatibilityRequirements/RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed/]
public class MyService : IMyService
{
public string Test//
{
return "success";
}
}
我想使用格式调用一种方法 url, 例如 :
http://example.com/MyService.svc/test
</system.servicemodel>
没有找到相关结果
已邀请:
2 个回复
知食
赞同来自:
http://www.codeproject.com/Art ... Guide
三叔
赞同来自:
配置
IMyService.cs
MyService.svc.cs
</system.servicemodel>