![](/img/trans.png)
[英]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.