如何获取HTTP POST请求中的数据,该数据在我的WCF服务中收到?提取HTTP POST数据(WCF C#)
我使用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();
,但是当我在WCF收到POST请求使用WebOperationContext.Current.IncomingRequest, 我不能找到一种方法来提取它我如何从HTTP POST请求中提取数据?
什么是你为了支持'应用/在你的WCF服务的X WWW的形式urlencoded'使用绑定? – 2011-03-27 09:03:51
你可以发布你的服务代码的样子吗?它看起来并不像你连接到WCF,而只是做一个标准的HTTP请求。 – Tridus 2011-03-27 11:43:49
@tridus - 发送POST请求的客户端将其作为标准HTTP POST发送,而不是从WCF发送。我如何从我的WCF中提取发送像上面的示例一样的POST数据? (链接,代码示例...) – Rodniko 2011-03-29 14:55:47