如何從C#類中調用POST類型的WCF方法?用C調用Restful WCF POST方法#
WCF方法
[OperationContract]
[WebInvoke(Method = "POST",
UriTemplate = "/process",
RequestFormat = WebMessageFormat.Json,
ResponseFormat = WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.Wrapped)]
MyRespons Process(MyRequest req);
我怎樣才能把這種從一個aspx代碼隱藏?
我試着用webclient接收流,它可以和任何get方法一起使用,但不能和POST一起使用。該方法適用於Fiddler和海報:
string getDeclarations = string.Format("{0}/process", ServiceBaseAddress);
var proxy = new WebClient();
proxy.DownloadStringCompleted += ProxyDownloadDeclarationsCompleted;
proxy.DownloadStringAsync((new Uri(getDeclarations)));
@ DanielA.White - 我編輯了這篇文章。 – 2012-08-10 12:57:34