2014-10-16 7 views
0

그래서이 머리를 벽에 대고 머리를 치려고했습니다. 여러 가지 다른 방법을 사용하여 SQL Server에서 데이터를 검색하려고 할 때마다 StackOverflow에서 서버가 손상되지만 정확한 원인을 정확히 찾아 낼 수 없습니다.Edge + Express + SQL Server 설명 할 수 없습니다. StackOverflow

나는 서버가 일어 났을 때 데이터베이스에서 데이터를 검색하는 Express와 함께 구조를 만들 수 있었지만 같은 방법으로 라우트를 연결하면 "The"StackOverflow를 얻을 수 있습니다 (확실하지 않습니다. 충돌에 대한 단일 원인이 있거나 스택 오버플로로 표시되는 두 가지 개별 문제를 다루는 경우

이 문제는 스택 오버플로에 대한 책임이 있기 때문에이 문제에 집중할 것입니다. 모든 충돌.

var express = require('express'); 
var http = require('http'); 
var edge = require('edge'); 

var app = express(); 
app.set('port',process.env.PORT || 3000); 
app.use(app.router); 


var repository = { 
    list: edge.func({assemblyFile:'bin\\Data.dll',typeName:'Data.GetListTask',methodName:'Invoke'}) 
}); 


app.get('/tickets', repository.list); 


http.createServer(app).listen(app.get('port'),function(request,response){ 
    console.log('Express server listening on port ' + app.get('port')); 
    console.log('[Before][repository.list]'); 
    repository.list({}, function(error, result) { 
     console.log('[Result][repository.list]'); 
     if(result){ 
      result.forEach(function(item){ 
       console.log('[List contains]{' + item.Id + '|' + item.Description + '}'); 
      }); 
     } 
     else{ 
     console.log('No items found'); 
     } 
    }); 
}); 
: 하여간

, 이것은 (차례로 ADO.NET 내 MSSQL의 DB를 호출한다)의 .NET 클래스 라이브러리에서 노드로 데이터를 마샬링 할 수 있었다 서버 설정입니다

서버가 시작될 때마다 저장소의 목록이 검색되어 콘솔에 스풀됩니다. 그러나 내/티켓 경로를 사용하면 서버가 스택 오버플로와 충돌합니다.

은 "좋은"응답이

: An image of the console as data is being marshaled back to node

나는 내 길을 정품 인증하려고 충돌 (실제 경로의 이름은 '티켓') An image of the crash when I try to activate my route

나는 매우 노드와 경험이 아니에요 또는 명시 적으로, 나는 '/ tickets'경로를 올바르게 지정했는지 확신 할 수 없다.

답변

0

이것은 내 Express 경로에서 어리석은 문제였습니다.

app.get('/tickets', function (request, response) { 
    ticketRepository.getTickets({}, function (error, result){ 
     response.json(result); 
    }); 
}); 

은 예상대로 내 데이터베이스에서 결과를 반환합니다.

protip : "stuff"로 응답하려는 경우 실제로 응답에 "stuff"를 넣는 것이 좋습니다.