Node.js REST API [英] nodejs REST api

查看:78
本文介绍了Node.js REST API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

我正尝试将基于nodejs的以javascript实现的REST api部署为Azure Webapp.

I'm trying to deploy a REST api implemented in javascript based on nodejs as an Azure Webapp.

它在本地工作.

但是当我在Azure中部署它时,我无法到达它.

But when I deploy it in Azure, I cannot reach it.

我按照https://docs.microsoft.com/zh-cn/azure/app-service/app-service-web-get-started-nodejs中描述的步骤进行操作.

I followed the the steps described in https://docs.microsoft.com/en-us/azure/app-service/app-service-web-get-started-nodejs.

有没有一种方法可以验证nodejs是否已启动以及使用了哪个js脚本?

Is there a way to validate nodejs is started ans which js script is used ?

推荐答案

在您说" 我无法达到它时要澄清一下", 您收到任何特定的错误消息吗?

Just to clarify, when you say, "I cannot reach it", do you receive any specific error messages?

1.您可以启用stdout和stderr的日志记录以获取问题的更多详细信息.您可以看一下博客'D

1.You may enable logging of stdout and stderr to fetch more details of the issue. You may take a look the steps outlined in the blog ‘Debug Node.js Web Apps on Azure’ to review the logs and see if that helps.

2.由于该应用在本地运行良好,通常 当您的wwwroot文件夹中的文件恰好应有的时候,就会发生运行时问题该网站无法正常运行的原因.您可以查看概述的建议 以帮助纠正此问题. 

2.As the app works fine locally, typically a runtime issue happens when the files in your wwwroot folder are exactly what they should be, but for some reason the site doesn't run correctly. You may checkout the suggestions outlined in Deployment vs runtime issues to help rectify the issue. 

3.万一您收到 500启动时出错,可能有以下原因:

3.In case you’re receiving 500 Errors when it starts, there could be a few reasons:

  1. Node.exe在正确的位置不存在.检查nodeProcessCommandLine设置.
  2. 主脚本文件不存在在正确的位置.检查web.config并确保处理程序部分中的主脚本文件的名称与主脚本文件匹配.
  3. 冷启动–您的应用启动时间过长.如果您的应用程序花费的时间超过(maxNamedPipeConnectionRetry * namedPipeConnectionRetryDelay)/1000秒, iisnode返回500错误.增加这些设置的值以匹配您的应用程序启动时间,以防止iisnode超时并返回500错误.
  1. Node.exe is not present at the correct location. Check nodeProcessCommandLine setting.
  2. Main script file is not present at the correct location. Check web.config and make sure the name of the main script file in the handler’s section matches the main script file.
  3. Web.config configuration is not correct – check the settings names/values.
  4. Cold Start – Your application is taking too long to start. If your application takes longer than (maxNamedPipeConnectionRetry * namedPipeConnectionRetryDelay) / 1000 seconds, iisnode returns a 500 error. Increase the values of these settings to match your application start time to prevent iisnode from timing out and returning the 500 error.


这篇关于Node.js REST API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆