Planning to build new project on Windows Azure Websites using node.js, I ran into issues with SQL Server module, that I just cant resolve:
I'm using downloaded binary of the module, with simple code from example, connecting to Azure hosted 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;Uid=user@server;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);
The example works locally from my PC, it is able to connect to Azure SQL and retrieve rows, although I had to downgrade node to 0.6.19 to make it work, but it fails when I deploy it to Azure. When I try to access website, after long waiting time I receive:
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.
I tried to compile node-sqlserver module from source, and again it worked on my PC, with the same result on Azure. Also I verified that module binary gets deployed(I'm using git to deploy).
Any ideas?