什么时候应该使用post vs get?在 WCF 上的 REST 服务中?,下面是我的界面
[OperationContract]
[WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
string DoLodge(string Id, Lodge value);
[OperationContract]
[WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
LodgeLevel[] GetLodgeLevels(string Id);
[OperationContract]
[WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
long GetLodgeCount(string Id);
最佳答案
将更新发送回服务器时应使用 POST。
从服务器检索对象时应使用 GET。
您可能想了解 HTTP 动词在 RESTful 服务上下文中的含义:
关于wcf - WCF 上的 REST 服务的 WebInvoke 方法 =“POST” 或 "GET",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4197956/