Running Web APIs with Kestrel
Following are instructions for running the Kestrel in the
production environment.
To run PowerServer Web APIs on Kestrel in the production
environment:
-
Go to the PowerServer C# solution > ServerAPIs > bin
> Release (or Debug) > net6.0 folder (for example,
C:Usersappeonsource
epossalesdemo_cloudServerAPIsinRelease
et6.0).When the PowerServer C# solution is generated, the Web APIs is
compiled (with Debug or Release mode) and all files (such as
configuration files, assembly files, dependencies, .NET runtime
etc.) required to run the app are included. -
Copy all files from the folder to the production
server. -
Run the ServerAPIs.exe file
in the same folder, in 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:1ServerAPIs.exe --urls "http://<hostname>:<port>"Or
1dotnet ServerAPIs.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.
-
-