Rest 服务方法=";删除";。方法不允许
我的方法的合同如下:Rest 服务方法=";删除";。方法不允许,rest,wcf,Rest,Wcf,我的方法的合同如下: [OperationContract] [WebInvoke(Method = "DELETE", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, UriTemplate = "/myMethod/{param}/", BodyStyle = WebMessageBody
[OperationContract]
[WebInvoke(Method = "DELETE",
RequestFormat = WebMessageFormat.Json,
ResponseFormat = WebMessageFormat.Json,
UriTemplate = "/myMethod/{param}/",
BodyStyle = WebMessageBodyStyle.Bare)]
void myMethod(string param);
我用小提琴来测试它
http://localhost:1234/MyService.svc/jsonMS/myMethod/1/
我收到错误“Method not allowed.”。如果在Fiddler中测试此方法,则需要确保:
- 向您的URL发送JSON请求
- 调用此方法时,请使用HTTP
方法(而不是DELETE
)GET