我创建了一个 Web API 并想用 postman 检查它,但不知道如何发布我的实体模型。总是模型为空
我使用 [FromForm] 给我发送模型,但所有值都为空,当使用 [Frombody]
发送空值
最佳答案
. your error is the CONTENT TYPE you're using to send the request
..你选择x-www-form-url-encoded
(HTML 表单的格式).. BUT if you want to use WebAPI and send your Entity in the PAYLOAD of yours request via REST .. you have to set CONTENT - TYPE as application/JSON
..
所以in POSTMAN do:
1- 选择类型 RAW
2- 在出现的下拉菜单中选择 application/json
3- paste your JSON in the Text Area
4- send it
希望对你有帮助!!
关于asp.net - 在 postman 中发送实体模型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47754392/