要将模型绑定到JSON主体而不使用[FromBody],您可以使用以下方法:
using System.IO;
using System.Text.Json;
[HttpPost]
public IActionResult MyAction()
{
    using (StreamReader reader = new StreamReader(Request.Body))
    {
        string jsonBody = reader.ReadToEnd();
        
        // 使用JsonSerializer.Deserialize将JSON转换为模型对象
        MyModel model = JsonSerializer.Deserialize(jsonBody);
        
        // 执行模型绑定后的逻辑
        // ...
        
        return Ok();
    }
}
 
using System.IO;
using Newtonsoft.Json;
[HttpPost]
public IActionResult MyAction()
{
    using (StreamReader reader = new StreamReader(Request.Body))
    {
        string jsonBody = reader.ReadToEnd();
        
        // 使用JsonConvert.DeserializeObject将JSON转换为模型对象
        MyModel model = JsonConvert.DeserializeObject(jsonBody);
        
        // 执行模型绑定后的逻辑
        // ...
        
        return Ok();
    }
}
 
无论您选择使用System.Text.Json还是Newtonsoft.Json,都需要确保在项目中添加相关的引用。