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 heresnode/@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
.nodefile which seems to happen automatically at deployment time.What worked for me was to include the pre-compiled
.nodefile from the article Jim mentions above (direct link at http://www.microsoft.com/en-us/download/details.aspx?id=29995) and put it in thenode_modules\node-sqlserver\libfolder alongside thesql.jsfile. Redeploy everything (including the.nodefile) and you should be good to go.Oh – I remember still seeing an error about not being able to compile the
.nodefile, but it seemed to run OK anyway since I’d provided the binary myself. Go figure…