Node.js服务器正在断开,没有任何错误
我正在使用edge模块()从sql数据库中读取数据。功能如下:Node.js服务器正在断开,没有任何错误,node.js,Node.js,我正在使用edge模块()从sql数据库中读取数据。功能如下: function getBetweenRows(cb) { //console.log("lastcheckedID inside function ", lastCheckedID); //console.log("lastinsertID inside function ", lastInsertID); console.log("here 2"); var query = { c
function getBetweenRows(cb) {
//console.log("lastcheckedID inside function ", lastCheckedID);
//console.log("lastinsertID inside function ", lastInsertID);
console.log("here 2");
var query = {
connectionString: "Data Source=localhost;Initial Catalog=db-name;Integrated Security=True",
//source: "SELECT * FROM CustomerMaster WHERE CustomerID BETWEEN '" + lastCheckedID + "' AND '" + lastInsertID + "';"
source: "SELECT * FROM CustomerMaster WHERE CustomerID BETWEEN '2965' AND '2972';"
};
console.log("query is ", query.source);
console.log("here 3");
var getRows = edge.func('sql', query);
console.log("here 4");
getRows(null, function(error, result) {
console.log("here 5");
if (error) {
console.log(error);
throw error;
log.error({rows:error});
}
rows = result;
log.info({rows:rows});
console.log(rows);
console.log("here 6");
cb(rows);
});
}
有趣的是,这段代码在其他一些系统上运行得很好。但是在这个特殊的系统上,它一直打印到
这里4
,然后服务器就坏了。它没有显示任何错误。如何找出问题所在?很抱歉,我不知道不同系统上发生的不同情况,但如果要调试并逐步查找两个系统上的差异,请使用节点调试器:
这是值得了解的
此外,我还注意到,在抛出错误时,偶尔会出现一些我还无法解释的问题。试着在有问题的系统上注释掉抛出行(也可能是log.js调用)。如果这解决了问题,您知道这与错误有关
告诉我你发现了什么