tjanczuk / iisnode

Hosting node.js applications in IIS on Windows
Other
1.85k stars 588 forks source link

@tjanczuk : iisnode and node-oracledb is it possible ?? #529

Open AmbarSoni777 opened 8 years ago

AmbarSoni777 commented 8 years ago

Application has thrown an uncaught exception and is terminated: Error: The specified module could not be found.

\?\C:\Program Files\iisnode\www\express\node_modules\oracledb\build\Release\oracledb.node

\ @tjanczuk : Is it possible to node-oracledb with iisnode ?

brunodenis commented 8 years ago

Yes, it is possible. More than a pain to compile but possible and working fine

luisjuniorj commented 7 years ago

@brunodenis, compilation ok, but same error... any tips?

ghaefele commented 7 years ago

@brunodenis, any additional tips how to get iisnode and oracledb work together?

On a Windows 10 development machine (oracledb compiled correctly and works fine outside iis + iisnode) I get:

Application has thrown an uncaught exception and is terminated:
Error: The specified module could not be found.

On a Windows Server 2008 (oracledb copied from development machine, oracledb works fine outside iis + iisnode) I get:

Application has thrown an uncaught exception and is terminated:
Error: %1 is not a valid Win32 application.

I am sure everything is in 64-bit (node, iis, oracledb...). Has anybody an oracledb application working correctly inside iis + iisnode? see issue #411

ghaefele commented 7 years ago

After some trial-and error experience I can confirm that iisnode and oracledb are working fine together.

In my case I had a full 64-bit environment (node, iisnode, iis, oracledb built with 64-bit, oracle 64-bit clients, all environment variables set, properly configured web.config, correct MS Run-Time Library installed).

The error "The specified module could not be found" resulted from missing permissions for the IIS user on the oracle client folder (oci.dll). The IIS-process could not read the oci.dll on which oracledb depends. During development and outside IIS, my account had permissions on this folder.

The error " %1 is not a valid Win32 application" resulted from a mixed 32-bit and 64-bit environment. If everything is 64-bit you will not get this error. The Microsoft utility "dumpbin" (Visual Studio command prompt) was very useful to figure out the problem (dumpbin /headers).

nicolas-bonnel commented 7 years ago

Following @ghaefele last answer, I finally managed to make it work. I also had a problem with Path environment variable being changed: all elements were still here, but not in the right order. The location to oracledb installation must be at the begining of Path. I currently have a ugly line of code to remove those two element of Path and prepend to it :

const oracleDirs = ['C:\\oracle\\instantclient','C:\\oracle\\instantclient\\sdk\\include']
process.env.Path = oracleDirs.join(';') + process.env.Path.split(';').filter(p => p.indexOf('oracle')<0).join(';')
const oracledb = require('oracledb')

I don't know how to preserve order in Path when launching the process with iis(node), even when it's the same user that launch the process than in command line, the Path order is messed.