标签:url sys message 请求 异步请求 异步 ons res cat
public static System.Xml.Linq.XElement Post(HttpClient _myhttp, string url, XmlDocument doc) { HttpContent content = new StringContent(doc.InnerXml, Encoding.UTF8, "application/xml"); var message = Task<HttpResponseMessage>.Run<HttpResponseMessage>(() => { return _myhttp.PostAsync(url, content); }); message.Wait(); //接收返回得信息 if (message.Result.IsSuccessStatusCode) { var s = Task<string>.Run<string>(() => { return message.Result.Content.ReadAsStringAsync(); }); s.Wait(); return System.Xml.Linq.XElement.Load(s.Result); } else { throw new Exception("StatusCode:" + message.Result.StatusCode.ToString()); } }
标签:url sys message 请求 异步请求 异步 ons res cat
原文地址:https://www.cnblogs.com/ZkbFighting/p/12915196.html