如何在我的WCF服务中收到的HTTP POST请求中获取数据?
我使用HTTP POST从另一个服务发送数据:
string ReportText = "Hello world";
ASCIIEncoding encoding = new ASCIIEncoding();
byte[] data = encoding.GetBytes(ReportText);
// Prepare web request...
String serverURL = ConfigurationManager.AppSettings["REPORT"];
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(serverURL);
myRequest.Method = "POST";
myRequest.ContentType = "application/x-www-form-urlencoded";
myRequest.ContentLength = data.Length;
Stream newStream = myRequest.GetRequestStream();
// Send the data.
newStream.Write(data, 0, data.Length);
newStream.Close();
Run Code Online (Sandbox Code Playgroud)
但是当我在WCF中收到POST请求时,我找不到使用WebOperationContext.Current.IncomingRequest提取它的方法,如何从HTTP POST请求中提取数据?