C#Restful Service使用WebInvoke POST方法 [英] C# Restful Service Using WebInvoke POST method
本文介绍了C#Restful Service使用WebInvoke POST方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨亲爱的:
我正在开发C#中的Restful服务,并且在我们工作时表现良好
Hi Dear:
I am developing a Restful service in C# and working well when I us
[OperationContract]
[WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Xml, BodyStyle = WebMessageBodyStyle.Wrapped, UriTemplate = "json/?id={id}")]
string jdata(string id);
and my corrsponding function implementation is:
public string json(string id)
{
return "You Typed : "+id;
}
到这里一切正常,
但是当我更改WenInvoke方法= POST我必须面对方法不允许。
Up to here all works well,
but when I change WenInvoke Method="POST" I have to face a "Method NOT Allowed.";
[WebInvoke(Method = "POST", ResponseFormat = WebMessageFormat.Xml, BodyStyle = WebMessageBodyStyle.Wrapped, UriTemplate = "json/?id={id}")]
string jdata(string id);
请回复解决我的问题。
谢谢。
推荐答案
尝试使用
BodyStyle = WebMessageBodyStyle.Bare,ResponseFormat = WebMessageFormat.Xml, RequestFormat = WebMessageFormat.Xml
这篇关于C#Restful Service使用WebInvoke POST方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文