繁体   English   中英

WCF多项服务合同的休息服务

[英]WCF Rest service with Multiple Operation contract

我想用操作合同创建WCF Rest服务,像这样

public interface ICustomerService  
{  
    [OperationContract]
    [WebInvoke(Method = "GET", RequestFormat = WebMessageFormat.Json,  
            ResponseFormat = WebMessageFormat.Json, UriTemplate = "/GetAllCustomer/")]  
    List<CustomerDataContract> GetAllCustomer();  

    [OperationContract]
    [WebInvoke(Method = "GET", RequestFormat = WebMessageFormat.Json,  
            ResponseFormat = WebMessageFormat.Json, UriTemplate = "/GetSTOCK/ABC")]  
    List<CustomerDataContract> GetSTOCK();  

    [OperationContract]
    [WebInvoke(Method = "GET", RequestFormat = WebMessageFormat.Json,  
            ResponseFormat = WebMessageFormat.Json, UriTemplate = "/GETSUPINFO/XYZ/ABC")]  
    List<CustomerDataContract> GETSUPINFO();   
} 

有人可以帮忙吗?

有两种方法可以使您的逻辑受Restful服务协议支持。 第一个是更改WCF服务,您可以参考以下链接以获取更多详细信息。 https://msdn.microsoft.com/zh-CN/library/dd203052.aspx

https://msdn.microsoft.com/zh-CN/library/bb412178(v=vs.90).aspx

更简单的方法是使用WepAPI包装逻辑,而保持WCF服务不变。 您还可以从以下链接中获取有关WebAPI的更多信息。

https://msdn.microsoft.com/zh-CN/library/hh833994(v=vs.108).aspx

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM