I am having this error on my page.
iisnode encountered an error when processing the request.
HRESULT: 0x2
HTTP status: 500enter code here
HTTP reason: Internal Server Error
You are receiving this HTTP 200 response because system.webServer/iienter code here
snode/@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 last 64k of the output generated by the node.exe process to stdout and stderr is shown below:
node.js:201 throw e; // process.nextTick error, or 'error' event on first tick ^ Error: Unable to load shared library C:\DWASFiles\Sites\leagues\VirtualDirectory0\site\wwwroot\node_modules\node-sqlserver\lib\sqlserver.node at Object..node (module.js:472:11) at Module.load (module.js:348:31) at Function._load (module.js:308:12) at Module.require (module.js:354:17) at require (module.js:370:17) at Object. (C:\DWASFiles\Sites\leagues\VirtualDirectory0\site\wwwroot\node_modules\node-sqlserver\lib\sql.js:20:11) at Module._compile (module.js:441:26) at Object..js (module.js:459:10) at Module.load (module.js:348:31) at Function._load (module.js:308:12)
and this is my code for server.js
var sql = require('node-sqlserver');
var conn_str = the value of ODBC in Connection Strings;
var http = require('http');
var port = process.env.port;
http.createServer(function(req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.write("start");
res.end("finish");
sql.query(conn_str, "SELECT * FROM GAME_PARTICIPANT", function(err, results) {
if (err) {
res.writeHead(500, {'Content-Type': 'text/plain'});
res.write("Database Error: " + err)
res.end("");
return;
}
res.writeHead(200, {'Content-Type': 'text/plain'});
for (var i = 0; i < results.length; i++) {
res.write("ID: " + results[i].PlayerID + " GameID: " + results[i].GameID + " Team: " + results[i].Team + " Confirmed: " + results[i].Confirmed + " RoleID: " + results[i].RoleID);
}
res.end("; Done.");
});
}).listen(port);
I ran into this error trying out the driver too.
Turns out, I didn't have all the prerequisites for compiling the .node
file which seems to happen automatically at deployment time.
What worked for me was to include the pre-compiled .node
file from the article Jim mentions above (direct link at http://www.microsoft.com/en-us/download/details.aspx?id=29995) and put it in the node_modules\node-sqlserver\lib
folder alongside the sql.js
file. Redeploy everything (including the .node
file) and you should be good to go.
Oh - I remember still seeing an error about not being able to compile the .node
file, but it seemed to run OK anyway since I'd provided the binary myself. Go figure...