我使用 ASP.NET Web API 从数据库中检索大量数据作为 json 数据列表,但在浏览器控制台中收到此错误:
Failed to load resource: the server responded with a status of 500 ()
以及浏览器页面中的此错误:
"InnerException": {
"Message": "An error has occurred.",
"ExceptionMessage": "The wait operation timed out",
"ExceptionType": "System.ComponentModel.Win32Exception",
"StackTrace": null
}
我该如何解决这个问题?
这是我的代码:
SqlConnection con = new SqlConnection(@"server = ...; database = ...; Integrated Security=false;
user id = ...; password = ...; Max Pool Size=2097151;");
public IHttpActionResult Getusers()
{
SqlDataAdapter da = new SqlDataAdapter("select * from usersnotifications", con);
DataTable dt = new DataTable();
da.Fill(dt);
if (dt.Rows.Count > 0)
{
return Ok(dt);
}
else
{
return Ok("No data found ...");
}
}
None
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)