tjanczuk / iisnode

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

Internal Server Error 1002 #541

Open WeiMengggg opened 7 years ago

WeiMengggg commented 7 years ago

I gave IUSR & IIS_IUSRS for the dante folder full control however, I'm having this error when i run the dante, could you please help? i tried searching online for help but i can't find out how to solve it. Thanks!

iisnode encountered an error when processing the request.

HRESULT: 0x2 HTTP status: 500 HTTP subStatus: 1002 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 last 64k of the output generated by the node.exe process to stderr is shown below:

Application has thrown an uncaught exception and is terminated: Error: EPERM: operation not permitted, lstat 'C:\Users\EPD_Group6' at Object.fs.lstatSync (fs.js:893:18) at Object.realpathSync (fs.js:1527:21) at toRealPath (module.js:132:13) at Function.Module._findPath (module.js:180:22) at Function.Module._resolveFilename (module.js:470:25) at Function.Module._load (module.js:420:25) at Module.require (module.js:500:17) at require (internal/module.js:20:19) at Object. (C:\Program Files\iisnode\interceptor.js:210:1) at Module._compile (module.js:573:32)

christiaanwesterbeek commented 7 years ago

You'll have to tell us more about your folder structure and web.config. Have you fixed the problem in the mean time? If so, please close this issue and share with us if you like how you fixed the problem.

camnpr commented 7 years ago

iisnode encountered an error when processing the request.

HRESULT: 0x2 HTTP status: 500 HTTP subStatus: 1002 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 stderr or iisnode was unable to capture this information. Frequent reason is that the iisnode module is unable to create a log file to capture stdout and stderr output from node.exe. Please check that the identity of the IIS application pool running the node.js application has read and write access permissions to the directory on the server where the node.js application is located. Alternatively you can disable logging by setting system.webServer/iisnode/@loggingEnabled element of web.config to 'false'.

weizensnake commented 7 years ago

Any progress on this? I am having the same problem as @camnpr . Just to rule out any Windows permissions problems I have given full access to the nodejs folder the folder that contains my Node application to the group "Everyone". Still getting the error, and no output from node.

Works perfectly fine on my Windows 10 laptop. Just not on a Windows Server 2012.

leonardoafpinto commented 7 years ago

I'm having the same problem:

iisnode encountered an error when processing the request.

HRESULT: 0x2
HTTP status: 500
HTTP subStatus: 1002
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 last 64k of the output generated by the node.exe process to stderr is shown below:

Application has thrown an uncaught exception and is terminated:
SyntaxError: Unexpected token ILLEGAL
    at Module._compile (module.js:437:25)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:362:17)
    at require (module.js:378:17)
    at Object.<anonymous> (C:\Program Files\iisnode\interceptor.js:210:1)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)

Has anyone fixed that problem? It is running on a Windows Server 2012.

flexplate commented 7 years ago

I'm having the exact same issue as @leonardoafpinto. Has anyone found a solution? The stack trace seems to indicate the issue is deep in the guts of Node or IISNode.

queequac commented 7 years ago

In my case it was sufficent on Windows Server 2012 R2 to set the application's identity from ApplicationPoolIdentity to NetworkService, while fiddling arround with permissions on folders does not help at all.

From my point of view this is an IIS security "issue" only, not related to internals of node or iisnode.

christiaanwesterbeek commented 7 years ago

@therezin Can you show the stack trace?

flexplate commented 7 years ago

@devotis I was referring to the output to stderr, which is exactly the same as in @leonardoafpinto's post above. Sorry if my terminology's incorrect, I'm a .Net guy and very new to Node.

queequac commented 7 years ago

@therezin Have you tried setting NetworkService or LocalSystem as identity for your IIS application?

My assumption is that this is related to node's way of finding modules, which can lead to trying to step into parent folders and looking for node_modules there... so even setting permissions for the folder where you put your javascript and node executable might lead to missing permissions for the parent folders.

Worked in my case and this assumption fits very well to the output shown above, especially

Error: EPERM: operation not permitted, lstat 'C:\Users\EPD_Group6'

christiaanwesterbeek commented 7 years ago

Note that the first poster obviously has a permission error, while @leonardoafpinto and supposedly @therezin too have a different error.

SyntaxError: Unexpected token ILLEGAL

I've googled this, and I found that it may be due to the use of the Greek Question Mark symbol instead of semi-columns. Or copy-pasting code from jsfiddle leading to invisible illegal characters.

So, check your code for this and let us know if that was the cause.

leonardoafpinto commented 7 years ago

Hello all,

I fixed my problem. I haven't followed the initial configuration of the server because other team did that. I've discovered that Node.js version linked on README.MD is 0.8.22, too old. I've updated it and it works. Besides, I've told here to update it but haven't done yet.

flexplate commented 7 years ago

I still get the same issue with the Application Pool's identity set to LocalSystem, NetworkService and ApplicationPooliIdentity:

iisnode encountered an error when processing the request. HRESULT: 0x2 HTTP status: 500 HTTP subStatus: 1002 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 last 64k of the output generated by the node.exe process to stderr is shown below: Application has thrown an uncaught exception and is terminated: SyntaxError: Unexpected token ILLEGAL at Module._compile (module.js:437:25) at Object.Module._extensions..js (module.js:467:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:362:17) at require (module.js:378:17) at Object. (C:\Program Files (x86)\iisnode\interceptor.js:210:1) at Module._compile (module.js:449:26) at Object.Module._extensions..js (module.js:467:10) at Module.load (module.js:356:32)

christiaanwesterbeek commented 7 years ago

@therezin Your issue is most likely not permission related. I suggest to focus on the error message: Unexpected token ILLEGAL. I posted a comment on that yesterday.

flexplate commented 7 years ago

@devotis You're right; for anyone finding this via search engine, mine and @leonardoafpinto's issue was that we'd got an old version of Node.js installed because the readme file links to an outdated version of Node.

I've filed a new issue for that (#579), and sent a pull request for a changed readme. Hope I haven't overstepped the mark.

jedallado commented 6 years ago

I was having the same issue and for it was just giving full control to IIS_IUSRS.

msi-matthew commented 5 years ago

Running npm cache clean --force fixed it for me.