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