首页 > 解决方案 > 我的 ASP.NET Core API 没有返回所有行

问题描述

我的 ASP.NET Core API 只返回 40 行中的前两行。

我努力了

services.AddMvc().AddJsonOptions(options => options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore);

它将 VS 代码发送到一个无限循环。关于在哪里寻找解决这个问题的任何想法?我正在使用浏览器和邮递员来使用具有相同结果的 api。

[EnableCors]
[HttpGet]
public ActionResult<IEnumerable<Fuaxclient>> GetClient()
{
    return _context.clientList;
}

我期望得到大约 48 行的正确 json 代码。相反,我得到 2 行和损坏的 json。我从 FireFox Web 控制台收到此错误

error: null​
headers: Object { normalizedNames: Map(0), lazyUpdate: null, headers: Map(0) }
​message: "Http failure response for https://fuaxclientapi.azurewebsites.net/api/fuaxclient: 500 Internal Server Error"​
name: "HttpErrorResponse"
​ok: false
​status: 500
​statusText: "Internal Server Error"
​url: "https://fuaxclientapi.azurewebsites.net/api/fuaxclient"

如果您想尝试 API 以了解我在说什么,该 API 仍在运行。​</p>

标签: c#jsonasp.net-coreasp.net-core-webapi

解决方案


好的,经过大量挖掘和研究并将我的头撞在桌子上,我发现了我的问题。我的数据库中有 NULL,API 在 NULL 处停止。


推荐阅读