似乎你复制了
web.config
文件从
Using a custom web.config for Node apps
替换第一个
server.js
用价值
index.js
代码中
<add name="iisnode" path="index.js" verb="*" modules="iisnode"/>
.
但是,还有两个
服务器,JS
也需要在标记中替换的值
rewrite
,如下所示。
<rewrite>
<rules>
<!-- Do not interfere with requests for node-inspector debugging -->
<rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">
<match url="^index.js\/debug[\/]?" /> // Replace `server.js` at here
</rule>
<!-- First we consider whether the incoming URL matches a physical file in the /public folder -->
<rule name="StaticContent">
<action type="Rewrite" url="public{REQUEST_URI}"/>
</rule>
<!-- All other URLs are mapped to the node.js site entry point -->
<rule name="DynamicContent">
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True"/>
</conditions>
<action type="Rewrite" url="index.js"/> // Replace `server.js` at here
</rule>
</rules>
</rewrite>
全部更换后
服务器,JS
具有
索引文件
,若要重新启动webapp并在浏览器中刷新页面,则可以看到它工作正常。
注意:Azure webapp上的默认node.js版本是
0.10.40
,因此首先需要通过设置
WEBSITE_NODE_DEFAULT_VERSION
应用程序设置中的值,请参阅我对so线程的回答
Azure NodeJS version
知道怎么做。