我已经创建了一个nodeJs应用程序,并已使用Azure Devops(VSTS)将其部署到Azure AppService 。
我必须指定 Web.config 来运行我的Node Application(否则,Azure AppService应用程序将不响应)。
Web.config文件如下所示。
问题是我不知道配置是在多核计算机上运行单个流程还是在多核计算机上运行?
Atleast我在Microsoft网站上的文档中没有看到它。
如何指示Azure AppService 使用所有内核?
我知道 pm2 npm模块,可以使用它,实际上我正在本地计算机上使用它。
但是如何告诉Azure使用它?
如何告诉 Web.config 使用 pm2 ?
有一个有关 AppService 最佳做法的文档,但该文档指示仅将 pm2 用于基于Linux的 App服务计划 ,而不是Windows版本。
https://docs.microsoft.com/mt-mt/azure/app-service/app-service-best-practices?toc=%2fazure%2fapp-service%2fcontainers%2ftoc.json&view=azurermps-6.10.0
<?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 -->
<handlers>
<!-- Indicates that this file is a node.js site to be handled by the iisnode module -->
<add name="iisnode" path="dist/index.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="^dist/index.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="dist/index.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>
答案 0 :(得分:1)
查看您的web.config文件:
<!--
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"/>-->
如果您点击此处提供的链接,将会看到可以进行以下设置:
所以:
<iisnode nodeProcessCountPerApplication="0"/>