当前位置: 首页 > news >正文

Azure部署nodejs webapp服务无法启动常见原因

0. 在 azure的webapp的 appsetting中添加nodejs版本号

WEBSITE_NODE_DEFAULT_VERSION, {nodejsVersion}

1.使用azure 的debug console来调试:
https://yourapp.scm.azurewebsites.net/DebugConsole

2. 尝试显示指定node的版本号 :"engines":{"node": "9.12.1"}  在 package.json中

3. 尝试一下azure的 zip deploy. 

https://docs.microsoft.com/en-us/azure/app-service/deploy-zip


确保 web.config 得 iisnode 包含了nodejs的启动服务:Server.js

<?xml version="1.0" encoding="utf-8"?>
<!--
     This configuration file is required if iisnode is used to run node processes behind
     IIS or IIS Express.  For more information, visit:

     https://github.com/tjanczuk/iisnode/blob/master/src/samples/configuration/web.config
-->

<configuration>
  <system.webServer>
    <!-- Visit http://blogs.msdn.com/b/windowsazure/archive/2013/11/14/introduction-to-websockets-on-windows-azure-web-sites.aspx for more information on WebSocket support -->
    <webSocket enabled="true" />
    <handlers>
      <!-- Indicates that the server.js file is a node.js site to be handled by the iisnode module -->
      <add name="iisnode" path="server.js" verb="*" modules="iisnode"/>
    </handlers>
    <rewrite>
      <rules>
        <!-- Do not interfere with requests for node-inspector debugging -->
        <rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">
          <match url="^server.js\/debug[\/]?" />
        </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="server.js"/>
        </rule>
      </rules>
    </rewrite>

    <!-- 'bin' directory has no special meaning in node.js and apps can be placed in it -->
    <security>
      <requestFiltering>
        <hiddenSegments>
          <remove segment="bin"/>
        </hiddenSegments>
      </requestFiltering>
    </security>

    <!-- Make sure error responses are left untouched -->
    <httpErrors existingResponse="PassThrough" />

    <!--
      You can control how Node is hosted within IIS using the following options:
        * watchedFiles: semi-colon separated list of files that will be watched for changes to restart the server
        * node_env: will be propagated to node as NODE_ENV environment variable
        * debuggingEnabled - controls whether the built-in debugger is enabled

      See https://github.com/tjanczuk/iisnode/blob/master/src/samples/configuration/web.config for a full list of options
    -->
    <!--<iisnode watchedFiles="web.config;*.js"/>-->
  </system.webServer>
</configuration>

 

相关文章:

  • 解读《第二十四次互联网报告》
  • 使用.NET SFTP 登陆linux上传下载文件
  • c# 使用7zip
  • Ubuntu source list
  • C# EF动态获取连接字符串的MSDTC配置
  • ubuntu 安装python3和open cv
  • Linux下类FreeBSD uprintf实现
  • ubuntu配置ssh服务
  • 软件项目一直赶工期,越改越忙,怎么破?
  • 迁移Blog平台
  • 使用Python face_recognition 人脸识别 - 1
  • 《BREW进阶与精通——3G移动增值业务的运营、定制与开发》连载之12---BREW里面有什么...
  • 使用Python face_recognition 人脸识别 - 2 人脸1-1比对
  • SUBMIT 的使用方法...
  • 《BREW进阶与精通——3G移动增值业务的运营、定制与开发》连载之13---BREW精要之COM 模型...
  • 【译】React性能工程(下) -- 深入研究React性能调试
  • 2017 年终总结 —— 在路上
  • canvas 五子棋游戏
  • es6要点
  • flask接收请求并推入栈
  • Java到底能干嘛?
  • Laravel5.4 Queues队列学习
  • MySQL-事务管理(基础)
  • PAT A1017 优先队列
  • React的组件模式
  • uni-app项目数字滚动
  • Vue UI框架库开发介绍
  • 关于 Linux 进程的 UID、EUID、GID 和 EGID
  • 前端相关框架总和
  • 如何实现 font-size 的响应式
  • 算法之不定期更新(一)(2018-04-12)
  • 做一名精致的JavaScripter 01:JavaScript简介
  • Java数据解析之JSON
  • 整理一些计算机基础知识!
  • #### go map 底层结构 ####
  • #ubuntu# #git# repository git config --global --add safe.directory
  • #Ubuntu(修改root信息)
  • $ is not function   和JQUERY 命名 冲突的解说 Jquer问题 (
  • $.ajax()
  • (C++17) optional的使用
  • (阿里巴巴 dubbo,有数据库,可执行 )dubbo zookeeper spring demo
  • (多级缓存)多级缓存
  • (附源码)springboot宠物医疗服务网站 毕业设计688413
  • (理论篇)httpmoudle和httphandler一览
  • (论文阅读11/100)Fast R-CNN
  • (原創) 如何使用ISO C++讀寫BMP圖檔? (C/C++) (Image Processing)
  • (转)iOS字体
  • .form文件_SSM框架文件上传篇
  • .Net Framework 4.x 程序到底运行在哪个 CLR 版本之上
  • .NET 药厂业务系统 CPU爆高分析
  • .NET/C# 中设置当发生某个特定异常时进入断点(不借助 Visual Studio 的纯代码实现)
  • .NET开源快速、强大、免费的电子表格组件
  • .Net组件程序设计之线程、并发管理(一)
  • @html.ActionLink的几种参数格式
  • [.net 面向对象程序设计进阶] (19) 异步(Asynchronous) 使用异步创建快速响应和可伸缩性的应用程序...