The PowerServer Web APIs is created during the build & deploy process and is ready to compile and run immediately after deployment.
Hosting environment: Development
For quick running and testing purpose, you could directly start the Web APIs with the built-in Kestrel server on the local development machine, using either of the following methods:
-
Method 1: Click the Run PowerServer Project button on the toolbar in the PowerBuilder IDE. The PowerServer Web APIs will be automatically compiled and run on the local machine.
-
Method 2: Run the Web APIs from the SnapDevelop IDE. Detailed instructions are provided below.
To compile and run the Web APIs from the SnapDevelop IDE:
-
Make sure your computer can connect to the NuGet site (https://www.nuget.org), so that the packages required for compiling and running the Web APIs can be successfully downloaded from the NuGet site.
-
Open the PowerServer C# solution in SnapDevelop.
Click the Open C# Solution in SnapDevelop button in the toolbar to launch the PowerServer C# solution in SnapDevelop. Or go to the location where the PowerServer C# solution is generated; and double click PowerServer_[appname].sln to launch the solution in SnapDevelop.
-
In the SnapDevelop IDE, make sure the ServerAPIs project is selected as the startup project and then click the Start icon.
-
Check the Output window and make sure build is successful.
-
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. The port number can be modified in the PowerServer C# solution > ServerAPIs project > Properties > launchSettings.json file, which is used by development environment only.
-
"Application started..." -- The Web APIs is started successfully.
-
"Hosting environment: Development" -- The Web APIs is currently running in the development 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.
-
Hosting environment: Production
In production environment and for optimal runtime performance, you should publish Web APIs to the dedicated server. Refer to Tutorial: Hosting Web APIs in Kestrel for how to run the PowerServer Web APIs on Kestrel in the production environment.
You could also deploy and run PowerServer Web APIs in other environments such as Docker, IIS, Kubernetes etc. Refer to Tutorial: Hosting Web APIs in Docker Containers, Tutorial: Hosting Web APIs in IIS, and Tutorial: Deploying installable cloud apps to Kubernetes.