【发布时间】:2018-12-14 22:19:05
【问题描述】:
我正在尝试将我的 nodejs rest api 应用程序部署到我的天蓝色云,但我一次又一次地失败。
我收到 HTTP 500 响应。
“由于发生内部服务器错误,页面无法显示。”
我的 AZURE FTP(我上传的):
web.config 文件
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<webSocket enabled="false" />
<handlers>
<add name="iisnode"
path="app.js"
verb="*"
modules="iisnode"/>
</handlers>
<rewrite>
<rules>
<rule name="NodeInspector"
patternSyntax="ECMAScript"
stopProcessing="true">
<match url="^app.js\/debug[\/]?" />
</rule>
<rule name="DynamicContent">
<conditions>
<add input="{REQUEST_FILENAME}"
matchType="IsFile"
negate="True"/>
</conditions>
<action type="Rewrite" url="app.js"/>
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
网址
请求:localhost/api/user/getcategories/5c141fa7498f3605c8b2cf34
回应:
{
"success": true,
"categories": [
{
"_id": "5c141fab498f3605c8b2cf35",
"name": "OTHER"
}
]
}
请求:https://**.azurewebsites.net/api/user/getcategories/5c141fa7498f3605c8b2cf34
响应:由于发生内部服务器错误,页面无法显示。
【问题讨论】:
-
我通过将 NodeJS 版本添加到“应用程序设置”面板解决了这个问题。 WEBSITE_NODE_DEFAULT_VERSION,8.9.4
标签: node.js rest api azure cloud