.Net Core WebAPI,无法使用POSTMAN发布数据,错误 - 415不支持的MediaType

Aru*_*E S 12 rest asp.net-web-api2 postman asp.net-core-mvc

我正在使用Postman测试我的第一个.net Core WebAPI

发生未知的媒体类型错误.

我错过了什么?

这是邮递员休息客户端

这是我的发布对象

public class Country
{
    [Key]
    public int CountryID { get; set; }
    public string CountryName { get; set; }
    public string CountryShortName { get; set; }
    public string Description { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

这是webapi控制器

[HttpPost]
public async Task<IActionResult> PostCountry([FromBody] Country country)
{
    if (!ModelState.IsValid)
    {
        return BadRequest(ModelState);
    }

    _context.Country.Add(country);
    try
    {
        await _context.SaveChangesAsync();
    }
    catch (DbUpdateException)
    {
        if (CountryExists(country.CountryID))
        {
            return new StatusCodeResult(StatusCodes.Status409Conflict);
        }
        else
        {
            throw;
        }
    }

    return CreatedAtAction("GetCountry", new { id = country.CountryID }, country);
}
Run Code Online (Sandbox Code Playgroud)

Geb*_*ebb 30

你没有发送Content-Type标题.JSON (application/json)在第一个屏幕截图中选择鼠标指针附近的下拉列表: 像这样