Использование плана обслуживания приложений MultiCore (Windows) для NodeJ в службе приложений Azure - PullRequest
0 голосов
/ 30 октября 2018

Я создал приложение nodeJs и развернул его в Azure AppService с помощью Azure Devops (VSTS).
Мне нужно указать Web.config для запуска моего приложения узла (в противном случае приложение Azure AppService не отвечает).
Файл Web.config можно увидеть ниже.
Проблема в том, что я не знаю, будет ли конфигурация работать с одним или несколькими процессами на многоядерном компьютере?
По крайней мере, я не видел этого в документации на веб-сайте Microsoft.
Как я могу указать Azure AppService использовать все ядра?
Я знаю о модуле pm2 npm и о том, что он может быть использован, и на самом деле я использую его на своей локальной машине.
Но как мне сказать, чтобы Azure использовал это?
Как я могу указать Web.config использовать pm2 ?
Для AppService имеется документация по передовым методам, но в нем указывается использовать pm2 только для Linux на основе План обслуживания приложений а не Windows one.
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>

1 Ответ

0 голосов
/ 14 ноября 2018

Посмотрите в своем файле 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"/>-->

Если вы перейдете по ссылке, указанной там, вы увидите, что вы можете установить это:

  • nodeProcessCountPerApplication - количество процессов node.exe, которые IIS запускает для каждого приложения; установка этого значения в 0 приводит к созданию одного процесса node.exe для каждого процессора на компьютере

Итак:

<iisnode nodeProcessCountPerApplication="0"/>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...