Built-in Kestrel

Kestrel is the default web server used for ASP.NET Core applications, therefore, the ServerAPIs project includes the Kestrel web server by default.

The ServerAPIs project > Properties > launchSettings.json file configures how the built-in Kestrel starts by default.

The launchSettings.json file is used only when you run PowerServer Web APIs in the local development environment, for example, when the ServerAPIs project is directly run from the PowerBuilder IDE, SnapDevelop, or VisualStudio; however, this file will not be included when PowerServer Web APIs is published to the production environment. (Read more)

The following three properties in launchSettings.json will be used, when you run PowerServer Web APIs in the PowerBuilder IDE:

  • the "commandName" key has the value "Project", it indicates the internal Kestrel web server will be launched;

  • the "ASPNETCORE_ENVIRONMENT" key configures the app's environment to Development;

  • the "applicationUrl" key configures the URL of the ASP.NET Core application (in this case, the PowerServer Web APIs); it is the host name and port number that the Kestrel server listens on. The port number is initially from the value configured in PowerBuilder IDE (the port of local Kestrel server in PowerServer project painter, which is 5099 by default).

    {
      "profiles": {
        "ServerAPIs": {
          "commandName": "Project",
          "launchBrowser": true,
          "launchUrl": "PowerServer",
          "environmentVariables": {
            "ASPNETCORE_ENVIRONMENT": "Development"
          },
          "applicationUrl": "http://localhost:5099/"
        }
      }
    }
    

Following outlines the key steps to deploy and run the PowerServer project using the built-in Kestrel (for detailed instructions, view this guide):

  1. In the PowerServer project painter, select the Deploy page > Basic tab, select Within the IDE and use the default settings of the local Kestrel server.

  2. Click the Build & Deploy Project button in the toolbar to build and deploy the project.

  3. Click the Run Project button in the toolbar.

    The ServerAPIs project will be automatically compiled and run with the Kestrel web server in the local development host environment, listening to "localhost" and port 5099 by default; and the client app deployed to "wwwroot" under the ServerAPIs project will run automatically, using the same host name and port number.