获取请愿书没有返回任何东西并保持思考
我正在与请愿书进行API,以发送我的数据库的所有数据。
它可以使所有功能都能毫无问题地获取所有数据,但是当到达返回线时,它会在那里思考并且永远不会返回任何东西。
[HttpGet("GetAll")]
[ProducesResponseType(StatusCodes.Status200OK)]
public ActionResult<List<Lead>> GetAll()
{
ActionResult<List<Lead>> list = BadRequest();
string query = @$"SELECT LeadID, CompanyName, CompanyAddress1, CompanyAddress2, CompanyCity,
CompanyState, PersonFirstName, PersonPhoneNumber, PersonEmail, Details, Distribuidor,
Comercial, TipoEstablecimiento, NombreChef, MailChef, JefeCompras, EmailJefeCompras,
EmailRestaurante, Latitud, Longitud, IDGoogle, UltimaVisita, FechaVisita, Clasificacion FROM dbo.Lead";
JsonArray ja = ExecQuery(query);
if (ja.Count > 0) {
var format = "dd/MM/yyyy h:mm:ss"; // DateTime format
var dateTimeConverter = new IsoDateTimeConverter { DateTimeFormat = format };
list = JsonConvert.DeserializeObject<List<Lead>>(ja.ToString(), dateTimeConverter)!;
}
else
list = NotFound("There are no leads");
Console.WriteLine("return");
return list;
}
在控制台中,我可以阅读我在返回之前发送的“返回”行,然后停下来并在那里思考,直到我停止Visual Studio中的项目。
我尝试只发送一条线索,但它毫无问题地返回。我尝试在控制台中打印我从数据库中获得的线索列表,这也是正确的。
编辑:如果我调用所需的所有列,则需要11分钟才能将结果退还结果。我有ñ和ç字符,这可能是问题吗?
I'm making an API with GET petition that sends all data of my DB.
It makes all the function and gets all data without problem but when arrives to the return line it stays there thinking and never return anything.
[HttpGet("GetAll")]
[ProducesResponseType(StatusCodes.Status200OK)]
public ActionResult<List<Lead>> GetAll()
{
ActionResult<List<Lead>> list = BadRequest();
string query = @quot;SELECT LeadID, CompanyName, CompanyAddress1, CompanyAddress2, CompanyCity,
CompanyState, PersonFirstName, PersonPhoneNumber, PersonEmail, Details, Distribuidor,
Comercial, TipoEstablecimiento, NombreChef, MailChef, JefeCompras, EmailJefeCompras,
EmailRestaurante, Latitud, Longitud, IDGoogle, UltimaVisita, FechaVisita, Clasificacion FROM dbo.Lead";
JsonArray ja = ExecQuery(query);
if (ja.Count > 0) {
var format = "dd/MM/yyyy h:mm:ss"; // DateTime format
var dateTimeConverter = new IsoDateTimeConverter { DateTimeFormat = format };
list = JsonConvert.DeserializeObject<List<Lead>>(ja.ToString(), dateTimeConverter)!;
}
else
list = NotFound("There are no leads");
Console.WriteLine("return");
return list;
}
In console i can read the line "return" that i send before the return and then stops and stays there thinking until I stop the project in Visual Studio.
I tried send only one lead and it returns without problems. I tried to print in console the list of leads that i get from the DB and it's all correct too.
EDIT: If I call all the columns that I need, it takes 11 min to return me the result. I have ñ and ç chars, can be this the problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决了,这是因为在返回行中,函数正在为 swagger 结果创建视图(对于此视图来说,10 分钟是很多时间!)。
我用reactJS做了一个请愿,速度确实更快。
谢谢大家对我的帮助!
Solved, it was because in return line the function was making the view for the swagger result (10 minutes is a lot of time for this view!).
I done a petition with reactJS and it was really faster.
Thank you all for help me!