This week is doing a WEBAPI simulation backstage. Have some problems. Share with you, have not done webapi before. So I don't know much.
When I send the JSON data for the POST request, if I use context. Request. When the form is collected, it is found that a half of JSON data runs into key, and other data in form[0] is strange. Then it dawned on me that I was sending it by myself. Use the form to receive, then go with HttpContext.Current.Request.InputStream.Read (Byts, 0, Byts. Length), read the stream directly and then transcode. Transcoding of course to use the code you sent over to turn, or it will be garbled. Discover that you can get the entire JSON. But there is a problem, I webapi in the post will enter the public void post ([frombody]string value) This method, in this method with Inputstream.read read, originally because [ Frombody]string value has been read over this side. If you write [Frombody]test Test], the values in the form will be written to the defined class. So the WEBAPI help us have encapsulated the get the data in the form into the class. But this is not a form, it's JSON, so just remove [frombody], call post () directly, and then read the stream data in the function.