[英]WCF rest api - [WebGet] working, but endpoint not found for [WebInvoke(…GET…)]
[英]WCF [operationcontract] can be ignored when you use REST's webinvoke or webget?
[WebInvoke(UriTemplate = "/GetContent", RequestFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped)]
public List<Content> GetContent(string path) {
return Utility.GetContent(path);
}
[OperationContract]
[WebInvoke(UriTemplate = "/GetContent", RequestFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped)]
public List<Content> GetContent(string path) {
return Utility.GetContent(path);
}
这两种方法的功能相同吗? 看起来他们俩都为我工作。
OperationContractAttribute属性声明方法是服务协定中的操作。 仅将具有OperationContractAttribute属性的方法公开为服务操作。 没有标有OperationContractAttribute的任何方法的服务合同不会公开任何操作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.