如何从 C# 类调用类型为 POST 的 WCF 方法?
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 和 POSTER:
string getDeclarations = string.Format("{0}/process", ServiceBaseAddress);
var proxy = new WebClient();
proxy.DownloadStringCompleted += ProxyDownloadDeclarationsCompleted;
proxy.DownloadStringAsync((new Uri(getDeclarations)));