选项1: 如果我手动反序列化我的JSON请求,我会得到正确的结果:
[Route("search")]
[HttpPost]
public IEnumerable<ErrorLogDto> Search(HttpRequestMessage request)
{
string res = request.Content.ReadAsStringAsync().Result;
LogSearchDto dto = JsonConvert.DeserializeObject(res, typeof(LogSearchDto)) as LogSearchDto;
//dto = not null
选项2:如果我使用它,我总是得到dto的NULL值:
[Route("search")]
[HttpPost]
public IEnumerable<ErrorLogDto> Search([FromBody]LogSearchDto dto)
{
// dto = null!
我没有想法如何调试这个..