PowerServer in IIS

When PowerServer Web APIs is deployed to IIS, IIS will automatically start the Web APIs. How this happens?

PowerServer Web APIs is an ASP.NET Core application. For IIS to start the ASP.NET Core application automatically, the ASP.NET Core Module (ANCM) must be installed; ANCM is installed when .NET Core Hosting Bundle is installed. And ANCM requires the web.config file to successfully start the ASP.NET Core app.

Suppose the IIS web site is set to use the physical path C:\inetpub\wwwroot as the web root. When PowerServer Web APIs is published to this IIS web site, there are two common scenarios (notice that the Web API URLs will be different):

  • Scenario 1: All compiled files (including the app executable file, app assembly files, dependencies, web.config etc.) that make up PowerServer Web APIs are placed directly under the physical path, as shown in the figure below.

    In this case, the physical path (C:\inetpub\wwwroot) becomes the content root path of PowerServer Web APIs; and the site URL becomes the Web API URL, for example, http://[ip]:[port].

    ANCM will successfully read the web.config file in the content root (C:\inetpub\wwwroot).

    The web.config file is automatically generated with the other compiled files in the same location and points to the Web API application executable file (ServerAPIs.exe) in the same folder, as shown in the example below.

    <configuration>
      <location path="." inheritInChildApplications="false">
        <system.webServer>
          <handlers>
            <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
          </handlers>
          <aspNetCore processPath="dotnet" arguments=".\ServerAPIs.exe" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
        </system.webServer>
      </location>
    </configuration>


  • Scenario 2: All compiled files (including the web.config file) are placed in a sub-folder under the physical path, for example, C:\inetpub\wwwroot\cloud_API.

    In this case, you must convert the sub-folder to an IIS sub-application; this will turn C:\inetpub\wwwroot\cloud_API into the app root for the PowerServer Web APIs, because only the web.config file in the app root can be read successfully by ANCM.

    The URL for accessing the Web APIs must include the sub-folder name, for example, http://[ip]:[port]/cloud_API; or you can modify the web.config file in the web root (C:\inetpub\wwwroot\) to point to this Web APIs, for example, ".\cloud_API\ServerAPIs.exe".

    When there are multiple PowerServer Web APIs under the same web site, for example, C:\inetpub\wwwroot\salesdemo_cloud_API, C:\inetpub\wwwroot\googlecharts_cloud_API etc., you will need to convert each one of them to an application (for detailed instructions, refer to this section).

    Note

    If there are multiple Web API apps in the same IIS web site using the in-process hosting model, each Web API app must be assigned with a different IIS application pool. (read more)

    If the web.config file in the web root (C:\inetpub\wwwroot\) points to one of these Web API apps, for example, ".\salesdemo_cloud_API\ServerAPIs.exe", then accessing http://[ip]:[port] or http://[ip]:[port]/salesdemo_cloud_API will start the same Web APIs.