天蓝色webapp webjob节点版本

编程入门 行业动态 更新时间:2024-10-26 22:29:31
本文介绍了天蓝色webapp webjob节点版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如何定义用于运行Azure Webjobs的节点版本?

How can I define the node version that is used to run azure webjobs?

该服务器当前使用v0.11执行我的代码,但由于我使用要求节点> 8的功能而失败

The server currently executes my code with v0.11 and fails since I use features that require node >8

Web应用程序本身可以在节点8上正常运行,但是webjobs的版本似乎独立于Web服务器本身.

The web app itself runs on node 8 just fine, but the version for webjobs seems to be independent of the webserver itself.

推荐答案

在Azure WebApp上,对于Node.js运行时,有一个默认版本,该版本早于0.10.40或其他类似0.11的版本,如您所说.如果要更改默认的Node版本以运行Webjob,可以通过以下两种方法对其进行配置.

On Azure WebApp, for Node.js runtime, there is a default version which be older that 0.10.40 or others like 0.11 as you said. If you want to change the default Node version for running your webjob, there are two ways below to configure it.

  • 要在Azure门户的Application settings选项卡中使用所需的版本号设置WEBSITE_NODE_DEFAULT_VERSION的值.您可以参考我对现有SO线程 Azure NodeJS版本的答案.

  • To set the value of WEBSITE_NODE_DEFAULT_VERSION with the version number you want in Application settings tab of Azure portal. You can refer to my answer for the existing SO thread Azure NodeJS version.

    要创建一个打包为Node JavaScript和引导文件的zip文件作为webjob,请参阅官方文档 Supported file types for scripts or programs .例如,一个WebJob zip文件包含index.js和run.bat,如下所示,您可以设置PATH环境以添加Azure支持的Node运行时路径(您可以按照上面的答案列出Azure上所有版本的NodeJS. )以使其正常工作.

    To create a zip file as webjob which wrapped your Node JavaScript and a bootstrap file, please refer to the offical document Supported file types for scripts or programs. For example, a WebJob zip file includes index.js and run.bat as below, you can set the PATH environment to add the Node runtime path supported by Azure (you can list all version of NodeJS on Azure by following my answer above) to make it works.

    index.js

    console.log(process.version)

    run.bat

    set PATH=D:/Program Files (x86)/nodejs/8.11.1/;%PATH% node index.js

    然后,按照下图步骤,您可以添加&运行您的webjob压缩文件,并通过Logs查看输出结果.

    Then, following the below figure steps, you can add & run your webjob zip file and see the output result via Logs.

    当我按如下所示设置节点运行时版本10.14.1时,这是Logs中的结果.

    Here is my result in Logs when I set my Node runtime version 10.14.1 as below.

  • 更多推荐

    天蓝色webapp webjob节点版本

    本文发布于:2023-11-15 22:55:52,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1598691.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:天蓝色   节点   版本   webjob   webapp

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!