Kestrel is by default included and enabled in the PowerServer Web APIs. For more, see About PowerServer Web APIs and Kestrel.
For how to run the PowerServer Web APIs on Kestrel in the local development environment, refer to Run the Web APIs (in development environment).
You can also publish and run PowerServer Web APIs on Kestrel in the production environment.
To publish and run PowerServer Web APIs on Kestrel in the production environment:
-
Publish the PowerServer Web APIs from the SnapDevelop IDE to a folder by following the instructions in this section.
The Web APIs will be compiled as an ASP.NET Core app and all files (such as configuration files, assembly files, dependencies, .NET runtime etc.) required to run the app will be copied to the publish folder.
-
Copy all files from the publish folder to the production server.
-
Run the app, in either of the following ways:
-
Method 1: Run the app as a service just like how you run any other ASP.NET Core app, so that it can be automatically run without needing you to log into the PC to start it.
To run the PowerServer Web APIs as a service in Windows, refer to https://docs.microsoft.com/aspnet/core/host-and-deploy/windows-service?view=aspnetcore-6.0&tabs=visual-studio.
To run the PowerServer Web APIs as a service in Linux, refer to https://docs.microsoft.com/aspnet/core/host-and-deploy/linux-nginx?view=aspnetcore-6.0#create-the-service-file.
-
Method 2: Run the app by executing the following command:
<app_assembly>.exe --urls "http://<hostname>:<port>"
Or
dotnet <app_assembly>.dll --urls "http://<hostname>:<port>"
If you don't specify the "--urls" argument, PowerServer Web APIs and Kestrel will by default run on http://localhost:5000 or https://localhost:5001. For more about the "--urls" argument for Kestrel, please refer to https://docs.microsoft.com/aspnet/core/fundamentals/servers/kestrel/endpoints?view=aspnetcore-6.0.
Make sure the API console window displays the following messages:
-
"Now listening on: http://x.x.x.x:yyyy" -- This is the root URL of the PowerServer Web APIs.
-
"Application started" -- The Web APIs is started successfully.
-
"Hosting environment: Production" -- The Web APIs is currently running in the production environment.
When the installable cloud application is run later, you can view the logs in the console window to check if the requests and responses are processed successfully.
-
-