简体   繁体   English

我的ASP.NET Core API未返回所有行

[英]My ASP.NET Core API not returning all rows

My ASP.NET Core API is only returning the first two rows out of 40. 我的ASP.NET Core API仅返回40中的前两行。

I have tried 我努力了

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

It sent VS code in to an endless loop. 它将VS代码发送到一个无限循环中。 Any ideas on where to look to fix this? 关于在哪里解决此问题的任何想法? I am using the browser and postman to consume the api with the same results. 我正在使用浏览器和邮递员使用具有相同结果的api。

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

I am expecting to get proper json code of about 48 rows. 我期望得到大约48行的正确json代码。 Instead I'm getting 2 rows and broken json. 相反,我得到2行和损坏的json。 I get this error from FireFox Web Console 我从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"

The API is still running if you would like to try the API to see what I'm talking about. 如果您想尝试API以查看我在说什么,该API仍在运行。

Ok after much digging and researching and banging my head on the desk, I have found my issue. 好了,经过大量的研究和研究,然后将我的头撞在桌子上,我发现了自己的问题。 I had NULL in my database and the API stopped at the NULL. 我的数据库中有NULL,并且API在NULL处停止。

status: 500
​statusText: "Internal Server Error"

As the error 500 itself suggests there error is on the server, in this case the url( endpoint api) stated as https://fuaxclientapi.azurewebsites.net/api/fuaxclient has issue. 正如错误500本身表明服务器上存在错误,在这种情况下,声明为https://fuaxclientapi.azurewebsites.net/api/fuaxclient的url(端点api)出现了问题。

It returns invalid json as validated here . 它返回此处验证的无效json。

The return value need to be fixed in the api. 返回值需要在api中固定。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM