web-api POST body object always null

 

If the any of values of the request‘s JSON object are not the same type as expected by the service then the [FromBody] argument will be null.

For example, if the age property in the json had a float value:

"age":18.0

but the API service expects it to be an int

"age":18

then student will be null. (No error messages will be sent in the response unless no null reference check).

web-api POST body object always null

上一篇:AcWing 240. 食物链


下一篇:教你一步一步部署.net免费空间OpenShift系列之四------绑定域名、使用CDN加速