使用 nodeProcessCountPerApplication 在 iisnode 上集群节点

clustering node on iisnode using nodeProcessCountPerApplication

我在 Azure 中有一个使用 node.js 和 socket.io 的网络应用程序,我决定使用 IISNODE 支持的集群,在我的 web.config[ 中使用如下的 nodeProcessCountPerApplication =12=]

<iisnode nodeProcessCountPerApplication="0" />

但是,当我应用它时,出现 500.1013 内部服务器错误,其中指出:

Most likely causes: IIS received the request; however, an internal error occurred during the processing of the request. The root cause of this error depends on which module handles the request and what was happening in the worker process when this error occurred. IIS was not able to access the web.config file for the Web site or application. This can occur if the NTFS permissions are set incorrectly. IIS was not able to process configuration for the Web site or application. The authenticated user does not have permission to use this DLL. The request is mapped to a managed handler but the .NET Extensibility Feature is not installed.

我查找了示例,但找不到任何类似的内容。我想知道我在这里做错了什么。我希望能够使用我机器的所有处理器。 谢谢!

通过使用以下 web.config 文件,我能够使用我的应用服务计划的所有处理器。

<?xml version="1.0" encoding="utf-8" ?>

<configuration>

  <system.webServer>
    <webSocket enabled="false" />
    <handlers>
      <add name="iisnode" path="app.js" verb="*" modules="iisnode" />
    </handlers>
    <rewrite>
      <rules>
        <rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">
          <match url="^app.js\/debug[\/]?" />
        </rule>
        <rule name="StaticContent">
          <action type="Rewrite" url="public{REQUEST_URI}" />
        </rule>

        <rule name="DynamicContent">
          <conditions>
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True" />
          </conditions>
          <action type="Rewrite" url="app.js" />
        </rule>
      </rules>
    </rewrite>
    <security>
      <requestFiltering>
        <hiddenSegments>
          <remove segment="bin" />
        </hiddenSegments>
      </requestFiltering>
    </security>

    <httpErrors existingResponse="PassThrough" />

    <iisnode watchedFiles="web.config;*.js" devErrorsEnabled="true" nodeProcessCountPerApplication="0" />
  </system.webServer>
</configuration>

当您在 Azure Web App 上使用 socket.io 时,您还需要在 Azure 门户中将 Web sockets 设置为 On。参见