About PowerServer Web APIs and Kestrel

Kestrel is the default web server used for ASP.NET Core applications. Whenever a new ASP.NET Core project (such as the ServerAPIs project in the PowerServer C# solution) is created, it includes the Kestrel web server by default. The Kestrel web server provides better request processing performance to ASP.NET Core applications as it is an open-source, cross-platform and light-weight web server; but it does not have advanced features of web servers like IIS, Nginx, Apache etc. For more details about Kestrel web server implementation in ASP.NET Core, see https://docs.microsoft.com/aspnet/core/fundamentals/servers/kestrel?view=aspnetcore-6.0.

As Kestrel is automatically included and enabled in the ServerAPIs project (PowerServer Web APIs), there is no need to install or configure Kestrel.

The PowerServer C# solution > ServerAPIs project > Properties > launchSettings.json file configures how Kestrel starts by default.

For more information about launchSettings.json, see https://docs.microsoft.com/aspnet/core/fundamentals/environments#development-and-launchsettingsjson.

  • "commandName" -- Specifies the web server to launch. Currently only "Project" is supported by PowerServer; it indicates the internal Kestrel web server will be launched.

  • "launchBrowser" -- Specifies whether to launch the PowerServer Web APIs in a web browser. This property is used when PowerServer Web APIs is run from SnapDevelop IDE, but not from PowerBuilder IDE.

  • "launchUrl" -- Specifies the default URL to be launched in the web browser. When it is set to "swagger", the Swagger UI will be launched automatically in the web browser. This property is used when PowerServer Web APIs is run from SnapDevelop IDE, but not from PowerBuilder IDE.

  • "ASPNETCORE_ENVIRONMENT" -- Specifies the app's runtime environment. Currently only "Development" is supported by PowerServer.

  • "applicationUrl" -- Specifies the application URL; it is the host name and port number that Kestrel server listens on. The port number is from the value configured in PowerBuilder IDE (the port of local Kestrel server in PowerServer project painter, which is 5099 by default).

    "ServerAPIs": {
      "commandName": "Project",
      "launchBrowser": true,
      "launchUrl": "swagger",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      },
      "applicationUrl": "http://0.0.0.0:5000/"
    }

Note

Keep in mind that the launchSettings.json file is used only when you run PowerServer Web APIs and Kestrel in the local development environment, for example, when PowerServer Web APIs is directly run from the PowerBuilder IDE, SnapDevelop, VisualStudio, or by using .NET Core CLI. And this file will not be included when PowerServer Web APIs is published to the production server.

The PowerServer Web APIs, as a standard ASP.NET Core application, can be hosted in the Kestrel web server, with or without using a reverse proxy server.

In the following graph, the PowerServer Web APIs is hosted in Kestrel and Kestrel is used as an edge (Internet-facing) server without a reverse proxy server.

  • Kestrel serves the dynamic content (such as data processing tasks) from the PowerServer Web APIs.

  • The static content (such as the client app, launcher, and runtime) can be hosted in the same Kestrel or in a separate IIS/Apache/Nginx server, in the same or different machine.


In the following graph, the PowerServer Web APIs is hosted in Kestrel, and Kestrel is used in a reverse proxy configuration.

  • Kestrel serves the dynamic content (such as data processing tasks) from the PowerServer Web APIs.

  • The reverse proxy server (such as IIS, Nginx, Apache etc.) forwards the requests to the PowerServer Web APIs running in Kestrel. The reverse proxy server may reside on a dedicated machine or may be deployed alongside a web server.

  • The static content (such as the client app, launcher, and runtime) can be hosted in the same Kestrel or in a separate IIS/Apache/Nginx server, in the same or different machine.