[英]Why doesn't Nodejs app work on Windows IIS
I use nodejs app with express i want to host on windows IIS. 我使用带有express的nodejs应用程序我希望在Windows IIS上托管。 On my IIS8 nodejs is working. 在我的IIS8 nodejs工作。 but I got an error 'Cannot GET /node/server.js' and I put rewrite rules in web.config. 但我得到一个错误'无法获取/node/server.js',我在web.config中添加了重写规则。 then I got the following error. 然后我得到以下错误。
HTTP Error 500.19 - Internal Server Error The requested page cannot be accessed because the related configuration data for the page is invalid. HTTP错误500.19 - 内部服务器错误无法访问请求的页面,因为页面的相关配置数据无效。
I discovered on internet. 我在网上发现了。 everyone suggest the following configuration but is not working on my windows 每个人都建议以下配置,但不能在我的窗户上工作
my web.config file is: 我的web.config文件是:
<configuration>
<system.webServer>
<handlers>
<add name="iisnode" path="server.js" verb="*" modules="iisnode" />
</handlers>
<defaultDocument>
<files>
<add value="server.js" />
</files>
</defaultDocument>
<rewrite>
<rules>
<rule name="LogFile" patternSyntax="ECMAScript" stopProcessing="true">
<match url="^[a-zA-Z0-9_\-]+\.js\.logs\/\d+\.txt$"/>
</rule>
<rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">
<match url="^server.js\/debug[\/]?" />
</rule>
<rule name="StaticContent">
<action type="Rewrite" url="public{REQUEST_URI}"/>
</rule>
<rule name="DynamicContent">
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True"/>
</conditions>
<action type="Rewrite" url="server.js"/>
</rule>
</rules>
</rewrite>
<iisnode nodeProcessCountPerApplication="8" watchedFiles="*.js;node_modules\*;routes\*.js;views\*.html"/>
</system.webServer>
</configuration>
any suggestion? 有什么建议吗? Thanks 谢谢
Your configuration file looks valid. 您的配置文件看起来有效。 So, you have to install iis rewrite extension and it works well. 所以,你必须安装iis重写扩展 ,它运行良好。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.