我正在尝试从调用简单 Web 服务的数据库将数据加载到 DataTables。出于某种原因,我有 500 Internal Server Error 。我已经测试了 Web 服务,它按预期返回数据。谢谢
[WebMethod(EnableSession = true)]
public string DataFromDB()
{
scansedDBEntities _db = new scansedDBEntities();
var query = from p in _db.Names
select p;
return JsonConvert.SerializeObject(query);
}
和 JavaScript:
$('#tblNames').dataTable({
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "../SSService.asmx/DataFromDB",
}
});