尝试按以下方式修改您的 HttpPost 方法:
[HttpPost("ApiTest")]
[Consumes("application/x-www-form-urlencoded")]
public IActionResult ApiTest([FromForm] Dictionary<string, string> values)
{
string name = values["name"];
return Ok(new { message = "200: Post Test Succesfull!" });
}
注意
Consumes
属性,并且 FromBody
变为 FromForm