2012-07-08 143 views
0

規劃對如何使用Node.js Windows Azure的網站建立新的項目時,我遇到了與SQL Server模塊的問題,我只是不能解析:微軟Azure節點sqlserver的問題

我使用的下載二進制模塊,與例如簡單的代碼,連接到Azure中託管的SQL Server:

var sql = require('node-sqlserver'); 
var http = require('http'); 

var conn_str = "Driver={SQL Server Native Client 10.0};Server=tcp:server.database.windows.net,1433;Database=database;[email protected];Pwd=mypass;Encrypt=yes;Connection Timeout=30;"; 

var port = process.env.port||3000; 
http.createServer(function (req, res) { 

sql.query(conn_str, "SELECT * FROM testdb.testtable", function (err, results) { 
    if (err) { 
     res.writeHead(500, { 'Content-Type': 'text/plain' }); 
     res.write("Got error :-(" + err); 
     res.end(""); 
     return; 
    } 
    res.writeHead(200, { 'Content-Type': 'text/plain' }); 
    res.end(JSON.stringify(results)); 
}); 

}).listen(port); 

的例子,從我的電腦本地工作,它能夠連接到Azure的SQL和檢索行,雖然我不得不降級節點至0.6 .19以使其工作,但在將其部署到Azure時失敗。當我嘗試訪問的網站,經過漫長的等待時間,我收到:

iisnode encountered an error when processing the request. 

HRESULT: 0x6d 
HTTP status: 500 
HTTP reason: Internal Server Error 
You are receiving this HTTP 200 response because system.webServer/iisnode/@devErrorsEnabled configuration setting is 'true'. 

In addition to the log of stdout and stderr of the node.exe process, consider using debugging and ETW  traces to further diagnose the problem. 

The node.exe process has not written any information to the stdout or stderr. 

我試圖從源代碼編譯節點SQLSERVER模塊,並再次它的工作在我的電腦上,用在Azure上相同的結果。我也驗證了模塊二進制文件被部署(我使用git進行部署)。

任何想法?

回答

1

好的,結果是SQL數據庫和網站位於不同的地理區域,儘管「提供給Azure服務」設置,Azure無法連接到不同地區的SQL服務器。必須移動數據庫,它的工作。