.net core 错误的响应标题内容类型.NET core 3

.net core 错误的响应标题内容类型.NET core 3,.net-core,controller,http-headers,.net Core,Controller,Http Headers,我试图返回对象列表,但控制器将响应头内容类型设置为text/plain,我得到了500个错误。我试图返回这个列表的单个对象(列表不是空的),但问题是相同的。然后我尝试返回简单对象(LoginModelDto),然后将响应头内容类型设置为正确(application/json),控制器返回200 OK。我不明白为什么.net core为表对象设置了不正确的响应头内容类型 _getData(data)返回IEnumerable,Table类由EF生成 这是我的控制器: [HttpPost("

我试图返回对象列表,但控制器将响应头内容类型设置为text/plain,我得到了500个错误。我试图返回这个列表的单个对象(列表不是空的),但问题是相同的。然后我尝试返回简单对象(LoginModelDto),然后将响应头内容类型设置为正确(application/json),控制器返回200 OK。我不明白为什么.net core为表对象设置了不正确的响应头内容类型

_getData(data)返回IEnumerable,Table类由EF生成

这是我的控制器:

    [HttpPost("Endpoint")]
    [Authorize(Roles = "User")]
    public IActionResult GetData([FromBody]Object data)
    {
        var id = User.Claims.FirstOrDefault(x => x.Type.Equals("Id", StringComparison.InvariantCultureIgnoreCase));
        if (id != null)
        {
            var res = _tableService.getData(data).ToList();
            //Table tbl = res.First();
            //LoginModelDto lgn = new LoginModelDto
            //{
            //    Email = "aaa",
            //    Password = "bbb"
            //};
            return Ok(res);
        }
        else
        {
            return BadRequest(new { message = "Identity not found" });
        }
这是我的表对象结构:

    public int [name] { get; set; }
    public int [name] { get; set; }
    public int [name] { get; set; }
    public int [name] { get; set; }
    public int [name] { get; set; }
    public bool [name] { get; set; }
    public DateTime [name] { get; set; }
    public DateTime? [name] { get; set; }

    public virtual Obj [objname] { get; set; }
    public virtual ICollection<OtherObj> [otherObjName] { get; set; }
public int[name]{get;set;}
公共int[name]{get;set;}
公共int[name]{get;set;}
公共int[name]{get;set;}
公共int[name]{get;set;}
公共bool[name]{get;set;}
公共日期时间[名称]{get;set;}
公共约会时间?[名称]{get;set;}
公共虚拟对象[objname]{get;set;}
公共虚拟ICollection[otherObjName]{get;set;}

从返回IEnumerable的
getData()
service\u tableService.getData()共享您的代码。表是实体框架生成的上下文类。返回的IEnumerable不为空。请从返回IEnumerable的
getData()
service\u tableService.getData()共享您的代码。表是实体框架生成的上下文类。返回的IEnumerable不为空。