[HttpPost]
public void Post([FromBody]dynamic value) {
try {
LogHlper.Instance.Logger(value);
LogHlper.Instance.Logger(HttpContext.Current.Request.ContentLength.ToString());
LogHlper.Instance.Logger(HttpContext.Current.Request.InputStream.Length.ToString());
string poststring = string.Empty;
using (Stream stream = HttpContext.Current.Request.InputStream) {
LogHlper.Instance.Logger(stream.Length.ToString());
Byte[] postBytes = new Byte[stream.Length];
stream.Read(postBytes, 0, postBytes.Length);
poststring = Encoding.UTF8.GetString(postBytes);
LogHlper.Instance.Logger(poststring);
HttpContext.Current.Response.Write("success");
}
}
catch (Exception ee) {
LogHlper.Instance.Logger("catch"+ee.ToString());
HttpContext.Current.Response.Write("success");
}
}
收到的消息不完整,以下为收到的消息
2016-12-18 10:43:47,349 CreateTime>1482029017</CreateTime>
<MsgType><![CDATA[text]]></MsgType>
<Content><![CDATA[88]]></Content>
<MsgId>6365266160152490236</MsgId>
</xml>