我开始使用我用nodejs构建的非常简单的API进行工作,并且它在Visual Studio IIS Express中运行正常,没有任何问题。 当我尝试将其移至iis时,我安装了最新版本的iisnode并继续执行所有步骤以使内置示例正常运行,但没办法!
重新启动IIS甚至机器 我认为这是我从许多教程中获得的所有内容,但从未使它起作用 错误: hello.js代码
var http = require('http');
http.createServer(function(req,res){ res.writeHead(200,{'Content-Type':'text / html'}); res.end('Hello,world![helloworld示例; iisnode版本为'+ process.env.IISNODE_VERSION +',节点版本为'+ process.version +']')); })。listen(process.env.PORT);
web.config代码
<!-- indicates that the hello.js file is a node.js application
to be handled by the iisnode module -->
<handlers>
<add name="iisnode" path="hello.js" verb="*" modules="iisnode" />
</handlers>
<rewrite>
<rules>
<rule name="ALLURL">
<match url="/*" />
<action type="Rewrite" url="hello.js" />
</rule>
</rules>
</rewrite>
/hello.js/debug不能很好地保持加载状态,它比在控制台中显示约125条错误消息,提示无法加载js文件
任何使它起作用的帮助将受到高度赞赏,我知道该节点可以自我托管该应用程序,但是它必须在iis上运行。