【发布时间】:2019-08-18 17:01:00
【问题描述】:
我的 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 仍在运行。
【问题讨论】:
-
你能显示
fuaxclientapi的操作吗? -
azure 上的日志是怎么说的。如果您生成 500 错误,则它应该生成服务器端日志。
-
API
https://fuaxclientapi.azurewebsites.net/api/fuaxclient正在返回无效的 JSON 结构。您需要在响应末尾附加带有]的字符串,以便正确解析此 JSON 字符串。 -
我将如何访问该日志?我仍在学习导航 azore 仪表板
标签: c# json asp.net-core asp.net-core-webapi