【发布时间】:2021-04-11 03:44:17
【问题描述】:
我有一个简单的 node.js 应用程序在 localhost:3000 上运行,打印“Hello world”。
当我从命令行启动它时,一切正常。
但是当我使用 IIS 启动它时(在 IIS 管理器中选择“浏览网站”),它会出现以下错误:
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 ...
从 StackOverflow 上的几个问题中,我发现这是一个权限问题。因此,我向该网站的用户授予了完全权限(遵循建议 here 和 here),但没有成功,同样的错误。
但是当我将应用程序池标识从 ApplicationPoolIdentity 更改为 LocalSystem 时,它可以工作。
我的问题是,这只是一次尝试,我不明白它为什么会起作用。我对此感到困惑,并担心这不是正确的方法。有人能帮我吗?或者解释一下为什么会这样?
【问题讨论】: