我有一个Web服务(.svc),我试图使用从StackOverflow上找到的代码来捕获SOAP请求。
问题是HttpContext.Current
为空,所以我无法访问Request.InputString
。
为什么会是空,如何解决?
XmlDocument xmlSoapRequest = new XmlDocument();
Stream receiveStream = HttpContext.Current.Request.InputStream;
receiveStream.Position = 0;
using (StreamReader readStream = new StreamReader(receiveStream, Encoding.UTF8))
{
xmlSoapRequest.Load(readStream);
}