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; and 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:inetpubwwwroot 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:inetpubwwwroot) 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:inetpubwwwroot).The web.config file is automatically generated with the
other compiled files in the same location and points to the Web
API application (ServerAPIs.exe)
in the same folder, as shown in the example below.12345678910<configuration><location path="." inheritInChildApplications="false"><system.webServer><handlers><add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" /></handlers><aspNetCore processPath="dotnet" <span><strong>arguments=".ServerAPIs.exe"</strong></span> stdoutLogEnabled="false" stdoutLogFile=".logsstdout" 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:inetpubwwwrootAPI.In this case, you must convert the sub-folder to an IIS
sub-application. This will turn C:inetpubwwwrootAPI into the
app root for the PowerServer Web APIs. 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]/API; or you can
modify the web.config file in the web root (C:inetpubwwwroot)
to point to this Web APIs, for example, “.APIServerAPIs.exe“,When there are multiple PowerServer Web APIs under the same
web site, for example, C:inetpubwwwrootAPI1,
C:inetpubwwwrootAPI2 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:inetpubwwwroot) points to one of these Web API apps, for
example, “.API2ServerAPIs.exe“, then accessing
http://[ip]:[port] or http://[ip]:[port]/API2 will start the Web
APIs.