Tutorial 1: Deploying your PowerServer project to production environment

In the Quick Start guide, we use the simplest scenario (all roles in one machine) to quickly get started with the PowerServer deployment; now in this tutorial, we will walk through the deployment process in a more production-like environment, using individual machines as the client, development PC, Web server, database server, and API server.

Important

For optimal runtime performance, it is highly recommended that the Web APIs should be published to a PowerServer that locates on the same LAN as the database server. If the database is not on the same network as the Web APIs, every request has to go a long way from PowerServer to the database, it is highly possible that there will be performance and security issues.

It is recommended that before you go through this tutorial you have a successful result with the Quick Start guide first, so that you have basic concepts of the whole deployment process.

Task 1: Setting up the client machine

Set up the client machine with the following OS and software:

  • Windows 10

  • Google Chrome

    This tutorial takes Google Chrome as an example. You can also use Firefox or the new Edge browser (Chromium-based).

Task 2: Setting up the database server

Preparations

In this tutorial, we will set up the salesdemo SQL Anywhere database server running in an independent machine.

Set up the database server with the following OS and software:

  • Windows Server 2019 (64-bit)

  • SQL Anywhere 17

    This tutorial takes SQL Anywhere database as an example. You can also install the other databases by following the documentation from the vendor.

    Note that the SQL Anywhere database can only be connected through an ODBC driver. You will need to create the same ODBC data source in both the development PC and the API server. The data source in the development PC is for converting DataWindows to models, and the data source in the API server is for accessing data from the database. The following sections have detailed instructions for how to create the ODBC data source.

Configuring Windows Defender Firewall

If Windows Defender Firewall or any antivirus tool is turned on, make sure to configure them to allow the database server port (2638 in this tutorial or the port number you choose to use) to go through, otherwise, connection errors may occur.

You would need to configure the firewall/antivirus settings on the following servers:

  • Database server -- to allow the database server port (2638 in this tutorial)

  • API server -- to allow the API server port (5009 in this tutorial)

  • Web server -- to allow the FTP server port (21 in this tutorial) (this only affects the FTP connection during the app deployment)

The following steps configure the firewall settings on the database server (you can take the same steps to configure the other servers):

Step 1: Open Windows Defender Firewall and then click Advanced settings.

Step 2: Select Inbound Rules and then click New Rule.


Step 3: Create a new rule which allows connections through the database server port (2638 in this tutorial).


Starting the database

Step 1: Copy the database file (pbdemo2021.db) from the development machine (%Public%\Documents\Appeon\PowerBuilder 21.0\) to the database server.

Step 2: Start this database file on the salesdemo database server using SQL Anywhere Network Server (dbsrv17.exe).

The database server must be started as a network server (not personal server) in order to support network connections.

"C:\Program Files\SQL Anywhere 17\Bin64\dbsrv17.exe" -x tcpip(port=2638) -n salesdemo "C:\DB\pbdemo2021.db"

Task 3: Setting up the Web server

The client-side of the installable cloud app can be hosted in the following Web servers:

  • Windows IIS

  • Windows/Linux Apache

  • Windows/Linux Nginx

Read the section below according to the Web server type used in your environment.

Setting up IIS
Preparations

In this tutorial, we will set up a Web server and an FTP server running on the same IIS instance.

Step 1: Set up the Web server with the following OS and software:

Step 2: Configure Windows Defender Firewall on the Web server to allow the FTP port (21 in this tutorial). The section "Configuring Windows Defender Firewall" has detailed instructions.

Installing Web Server (IIS)

Step 1: In Windows Server 2019, open Server Manager, and then select Add roles and features.

Step 2: In the Add Roles and Features Wizard, click Next several times until the Server Roles section displays.

Step 3: Click the check box of Web Server (IIS); and then click Add Features when asked whether to add features required for Web server.


Step 4: Make sure the check box of Web Server (IIS) is selected.


Step 5: Click Next until the Role Services section displays. Make sure the following role services are selected.

Select to enable the following services:

  • Default Document

  • Static Content

  • .NET Extensibility 4.7

  • Application Initialization

  • ASP.NET 4.7

  • ISAPI Extensions

  • ISAPI Filters

  • IIS Management Console

  • FTP Service

  • FTP Extensibility

    FTP Service & FTP Extensibility must be enabled if you want to create an IIS FTP site for transferring files from a remote development machine to the Web server.


Step 6: Click Next and then click Install.

After IIS is installed, a Default Web Site is automatically created.


Step 7: Open a Web browser and run the following URLs to access the Default Web Site.

http://localhost:80/

http://your_server_ip:80/

TIP: to obtain the IP address, open a command prompt window and then type ipconfig<Enter>. Write down the IP address as it is needed when you configure the Web server profile in PowerBuilder.

If the IIS welcome screen displays, the IIS website is working properly.


Also remember the physical path for Default Web Site which is C:\inetpub\wwwroot by default (or any other path you have changed to). This is where the client app will be deployed, or the FTP site will point to.

Creating an IIS FTP site

Note

To deploy the client app from the local development PC to the remote Web server, you can choose:

  • Method 1: Deploy the client app to the remote server through the FTP protocol.

    1. Set up an FTP server (the FTP server's physical path must point to the Web root of the Web server).

      This section will walk you through how to set up an FTP server.

    2. Deploy the client app from the local machine to the remote server through the FTP server.

      "Task 4: Setting up the development PC" has detailed instructions.

  • Method 2: Package the client app and then install (or copy) it to the Web root of the Web server.

    Follow the instructions in Packaging and copying the client app to package the client app and then install (or copy) it to the Web server Web root.

The following steps will walk you through setting up an IIS FTP site on the Web server, so that PowerBuilder can deploy files to the remote server through the FTP protocol.

In the previous section, if you have selected to enable FTP Service & FTP Extensibility, you can create an IIS FTP site to be used by the remote deployment.

Step 1: In the IIS Manager, right click Sites, select Add FTP Site.

Step 2: Specify a name for the FTP site, and set the physical path to the Web root of the IIS Web server (C:\inetpub\wwwroot in this tutorial). Click Next.


Step 3: Use the default port 21 (or specify a different port if you like). If no certificate is available, you can select No SSL. Use the default values for the other settings. Click Next.

For how to configure SSL on an IIS FTP site, refer to Configure an SSL-based FTP server.


Step 4: Select Anonymous and Basic authentication. Select All users or specify the users that are allowed to access the FTP site, and then select the Read and Write permissions. Click Finish.


The FTP site is created.


Step 5: Open a Web browser and run the following URL to access the FTP site.

ftp://your_server_ip:21/

If the FTP root displays, then the FTP site is working properly.


Setting up Apache on Windows
Preparations

In this tutorial, we will set up a Web server running on Apache HTTP Server on Windows.

Step 1: Set up the Web server with the following OS and software:

  • Windows Server 2019 (64-bit)

  • Visual C++ Redistributable

  • Apache HTTP Server 2.4.47

    The next section Installing Apache HTTP Server has detailed installation instructions.

Step 2: Configure Windows Defender Firewall on the Web server to allow the port (the HTTP port is 80 and the FTP port is 21 in this tutorial) to go through. The section "Configuring Windows Defender Firewall" has detailed instructions.

Installing Apache HTTP Server

Step 1: Select a binary package provider for Apache for Windows from https://httpd.apache.org/docs/current/platform/windows.html#down.

Step 2: In this tutorial, select Apache Lounge, and then download the following packages from https://www.apachelounge.com/download/.

Step 3: Double click VC_redist.x64.exe to install the Visual C++ Redistributable first.

Step 4: Unzip the httpd-2.4.47-win64-VS16.zip file and place the Apache24 folder under the C drive ("C:\Apache24" is the default ServerRoot in conf\httpd.conf; and the default folder for web files is DocumentRoot "C:\Apache24\htdocs"). If you place the Apache24 folder to another location, change the following setting accordingly.

Define SRVROOT "c:/Apache24"

Note

Paths in httpd.conf and other configuration files must be specified using forward slashes ("/") instead of back slashes ("\").

You could also change the IP address, port number, server name etc. in httpd.conf rather than using the default values.

Step 5: Open the command prompt window, go to the C:\Apache24\bin folder, and run the Apache HTTP server.

cd C:\Apache24\bin
httpd.exe


Step 6: Test the Apache HTTP server by opening up a Web browser and typing in the address: http://localhost.

The following message indicates the Apache HTTP server is working properly.

You can further test from the development PC by typing http://your_server_ip in a browser.


The Using Apache HTTP Server on Microsoft Windows page has more detailed documentation about using Apache on Windows.

Installing FTP server

Note

To deploy the client app from the local development PC to the remote Web server, you can choose:

  • Method 1: Deploy the client app to the remote server through the FTP protocol.

    1. Set up an FTP server (the FTP server's physical path must point to the Web root of the Web server).

      This section will walk you through how to set up an FTP server.

    2. Deploy the client app from the local machine to the remote server through the FTP server.

      "Task 4: Setting up the development PC" has detailed instructions.

  • Method 2: Package the client app and then install (or copy) it to the Web root of the Web server.

    Follow the instructions in Packaging and copying the client app to package the client app and then install (or copy) it to the Web server Web root.

The following steps will walk you through setting up an FTP server on the Web server, so that PowerBuilder can deploy files to the remote server through the FTP protocol.

In this tutorial, we set up an IIS FTP server.

To enable the IIS FTP service and create an IIS FTP site,

Step 1: Follow the instructions in Installing Web Server (IIS) until the Role Services section displays; and make sure the following role services are selected and installed.

  • FTP Server

    • FTP Service

    • FTP Extensibility

  • Management Tools

    • IIS Management Console


Step 2: Follow the instructions in Creating an IIS FTP site to create an FTP site and set the physical path to the document root of the Apache HTTP server which is C:\Apache24\htdocs by default.


Step 3: Test the FTP site by opening up a Web browser and typing in the address: ftp://localhost.

The following message indicates the FTP site is working properly.

You can further test from the development PC by typing ftp://your_server_ip in a browser. (If access failed, check that if the firewall has blocked the FTP port; you can try to turn off the firewall on the server.)


Setting up Apache on Linux
Preparations

In this tutorial, we will set up a Web server running on Apache HTTP Server on Linux.

Step 1: Set up a server with the following OS and software:

Step 2: Configure the CentOS user account: you can either use the root account or create a new account with administrative privileges.

Step 3: Set up a firewall on the server and make sure the firewall allows the port (the HTTP port is 80 in this tutorial) to go through.

Step 4: Make sure the server can connect to Internet during the installation of Apache HTTP Server.

Installing Apache HTTP Server

Step 1: Download and install Apache HTTP Server from the CentOS's default software repositories. Make sure the machine can connect to Internet during the download and installation process.

$ sudo dnf install httpd

During the download and installation process, you might be prompted to enter the password for your user account, or enter y to confirm that you want to install Apache.

Step 2: Start Apache HTTP Server.

$ sudo systemctl start httpd

Step 3: Verify that the HTTP Server service is running.

$ sudo systemctl status httpd


Step 4: If you have set up a firewall on the server, run the following command to permanently enable HTTP service and port 80:

# sudo firewall-cmd --permanent --zone=public --add-service=http
# sudo firewall-cmd --permanent --zone=public --add-port=80/tcp

To apply the changes, reload the firewall service using the following command:

# sudo firewall-cmd --reload

To verify that the http service and port 80 were added successfully, you can run:

# sudo firewall-cmd --permanent --list-all 


Step 5: (An additional configuration) As PowerBuilder is designed to be case-insensitive, therefore, in a case-sensitive system like Linux, some app files (such as images) may not be found or loaded. To avoid any issue caused by the case of file name, add the following configuration to ignore case-sensitive in Linux system.

  1. Go to the /etc/httpd/conf folder, and open httpd.conf in a text editor.

  2. Search "loadmodule" and add the following lines. Note the word speling (not spelling)

    LoadModule speling_module modules/mod_speling.so
    CheckSpelling on
    


  3. Check if any syntax error in httpd.conf.

    $ sudo apachectl configtest
  4. Restart Apache.

    $ sudo systemctl restart httpd

    If Apache failed to start, go to the /var/log/httpd folder and view the error_log.log and access_log.log file to read the detailed error information.

Step 5: Test the Apache HTTP server by opening up a Web browser and typing in the address: http://localhost or http://your_server_ip.

The following page indicates the Apache HTTP server is installed and started successfully.

You can further test from the development PC by typing http://your_server_ip in a browser.


Packaging and copying the client app

Tip

To deploy the client app from the local development PC to the remote Web server, you can choose:

  • Method 1: Deploy the client app to the remote server through the FTP protocol.

    1. Set up an FTP server (the FTP server's physical path should point to the Web root of the Apache HTTP Server: /var/www/html/).

    2. Deploy the client app from the local development machine to the remote Web server through the FTP server.

  • Method 2: Package the client app and then install (or copy) it to the Web root of the Web server.

    This section will walk you through packaging and copying the client app to the Web root of the Apache HTTP Server: /var/www/html/.

Before you take the steps below to package the client app, make sure you have built the application successfully by following instructions in the next section "Task 4: Setting up the development PC".

Step 1: In the PowerServer project painter, select the Client Deployment tab, then select Package the compiled app and manually deploy later, and then select Zipped file, Package Cloud App Launcher, and Package the runtime files.


Step 2: Save the project settings and then click the Build & Deploy PowerServer Project or Deploy PowerServer Project button in the toolbar to generate the package.

When the packaging process is completed, the folder that contains the generated file will be displayed.

Step 3: Copy and extract the generated zipped file to the Web root of the Apache HTTP Server: /var/www/html/.

Setting up Nginx on Windows
Preparations

In this tutorial, we will set up a Web server running on Nginx.

Step 1: Set up the Web server with the following OS and software:

  • Windows Server 2019 (64-bit)

  • Nginx 1.19.10

    The next section Installing Nginx has detailed installation instructions.

Step 2: Configure Windows Defender Firewall on the Web server to allow the port (the HTTP port is 80 and the FTP port is 21 in this tutorial). The section "Configuring Windows Defender Firewall" has detailed instructions.

Installing Nginx

Step 1: Download Nginx/Windows-1.19.10 from http://nginx.org/en/download.html.

Step 2: Unzip the downloaded nginx-1.19.10.zip file and place the nginx-1.19.10 folder under the C drive or any location you like.

Step 3: Open the command prompt window, go to the nginx-1.19.10 folder, and run Nginx.

cd C:\nginx-1.19.10
start nginx

You could also change the IP address, port number etc. in conf\nginx.conf rather than using the default values.

Note

Paths in nginx.conf and other configuration files must be specified using forward slashes ("/") instead of back slashes ("\").

Step 4: Run the tasklist command to see if the Nginx processes are running.

tasklist /fi "imagename eq nginx.exe"


Step 6: Test the Nginx web server by opening up a Web browser and typing in the address: http://localhost.

The following page indicates the Nginx web server is working successfully.

You can further test from the development PC by typing http://your_server_ip in a browser.


The Nginx for Windows page has more detailed documentation on using Nginx on Windows.

Installing FTP server

Note

To deploy the client app from the local development PC to the remote Web server, you can choose:

  • Method 1: Deploy the client app to the remote server through the FTP protocol.

    Step 1: Set up an FTP server (the FTP server's physical path must point to the Web root of the Web server).

    This section will walk you through how to set up an FTP server.

    Step 2: Deploy the client app from the local machine to the remote server through the FTP server.

    "Task 4: Setting up the development PC" has detailed instructions.

  • Method 2: Package the client app and then install (or copy) it to the Web root of the Web server.

    Follow the instructions in Packaging and copying the client app to package the client app and then install (or copy) it to the Web server Web root.

The following steps will walk you through setting up an FTP server on the Web server, so that PowerBuilder can deploy files to the remote server through the FTP protocol.

In this tutorial, we set up an IIS FTP server.

To enable the IIS FTP service and create an IIS FTP site,

Step 1: Follow the instructions in Installing Web Server (IIS) until the Role Services section displays; and make sure the following role services are selected and installed.

  • FTP Server

    • FTP Service

    • FTP Extensibility

  • Management Tools

    • IIS Management Console


Step 2: Follow the instructions in Creating an IIS FTP site to create an FTP site and set the physical path to the server root of Nginx which is nginx-1.19.10\html by default.


Step 3: Test the FTP site by opening up a Web browser and typing in the address: ftp://localhost.

The following message indicates the FTP site is working successfully.

You can further test from the development PC by typing ftp://your_server_ip in a browser. (If access failed, check that if the firewall has blocked the FTP port; you can try to turn off the firewall on the server.)


Setting up Nginx on Linux
Preparations

In this tutorial, we will set up a Web server running on Nginx on Linux.

Step 1: Set up a Web server with the following OS and software:

  • CentOS 8 (64-bit)

  • Nginx

    The next section Installing Nginx has detailed installation instructions.

Step 2: Configure the CentOS user account: you can either use the root account or create a new account with administrative privileges.

Step 3: Set up a firewall on the server and make sure the firewall allows the port (the HTTP port is 80 in this tutorial) to go through.

Step 4: Make sure the server can connect to Internet during the installation of Nginx.

Installing Nginx

Step 1: Download and install Nginx from the CentOS's default software repositories. Make sure the machine can connect to Internet during the download and installation process.

$ sudo dnf install nginx

During the download and installation process, you might be prompted to enter the password for your user account, or enter y to confirm that you want to install Nginx.

Step 2: Enable and start the Nginx HTTP server when the installation is completed.

$ sudo systemctl enable nginx
$ sudo systemctl start nginx

Step 3: Verify that the Nginx HTTP server service is running.

$ sudo systemctl status nginx.service


Step 4: If you have set up a firewall on the server, run the following command to permanently enable the HTTP service and port 80:

# sudo firewall-cmd --permanent --zone=public --add-service=http
# sudo firewall-cmd --permanent --zone=public --add-port=80/tcp

To apply the changes, reload the firewall service using the following command:

# sudo firewall-cmd --reload

To verify that the http service and port 80 were added successfully, you can run:

# sudo firewall-cmd --permanent --list-all


Step 5: Test the Nginx HTTP server by opening up a Web browser and typing in the address: http://localhost.

The following page indicates the Nginx HTTP server is installed and started successfully.

You can further test from the development PC by typing http://your_server_ip in a browser.


Packaging and copying the client app

To deploy the client app from the local development PC to the remote Web server, you can choose:

  • Method 1: Deploy the client app to the remote server through the FTP protocol.

    1. Set up an FTP server (the FTP server's physical path should point to the Web root of the Nginx HTTP server which is /usr/share/nginx/html by default).

    2. Deploy the client app from the local development machine to the remote Web server through the FTP server.

  • Method 2: Package the client app and then install (or copy) it to the Web root of the Web server.

    Follow the instructions in Packaging and copying the client app to package and copy the client app to the Web root of the Nginx HTTP server: /usr/share/nginx/html.

Task 4: Setting up the development PC

Preparations

Set up the development machine with the following OS and software (install the software in the order listed):

  • Windows 10 (64-bit)

  • SQL Anywhere 17

  • PowerBuilder IDE 2021

    During installation, make sure to select the SQL Anywhere engine for the PowerBuilder demo database.

    The PowerBuilder demo database file for SQL Anywhere (pbdemo2021.db) will be installed to the %Public%\Documents\Appeon\PowerBuilder 21.0\ directory.


  • PowerBuilder Runtime 2021

  • PowerServer Toolkit 2021

  • SnapDevelop 2021 (optional)

  • Google Chrome (optional)

Creating the ODBC data source

A database connection needs to be established between the development PC and the database server (for converting DataWindows to models), and between the API server and the database server (for retrieving data). Currently the SQL Anywhere database can only be connected through an ODBC driver, therefore, you will need to create the same ODBC data source in both:

  • the development PC, and

  • the API server

The following steps create an ODBC data source on the development PC that connects to the salesdemo SQL Anywhere database server (you can take the same steps to configure the API server):

Step 1: Install SQL Anywhere 17.

Step 2: Create a 64-bit ODBC data source and name it as "SalesDemo DB". The data source name must be the same in both the development PC and the API server.

IMPORTANT: Make sure you use the 64-bit version of ODBC administrator to create the data source, because only the 64-bit ODBC data sources can be selected for the PowerServer project.

Step 3: Click Test Connection to ensure the connection settings are correct.



Creating a Web server profile for remote deployment

Step 1: Go to the development PC, select Windows Start | Appeon PowerBuilder 2021, and then right-click Example Sales App and select More | Run as administrator. The SalesDemo workspace is loaded in the PowerBuilder IDE.

Step 2: Select Tools>Web Server Profile from the PowerBuilder menu bar to open the Web Server Profile window.

Step 3: In the Web Server Profile window, click Add.

Step 4: Select Remote server, and then specify the settings for connecting to the FTP site.

In this tutorial, specify the following values (or the values you chose):

Server profile name: Any text, for example, Remote IIS Web Server, Remote Apache HTTP Server, Remote Nginx, etc.

Host: IP address or host name of the FTP site, for example, 172.16.100.63.

Port: Port number of the FTP site, for example, 21.

Username: Windows user name.

Password: Windows user password.


Step 5: Click Test FTP Connection and make sure connection to the FTP site is successful.

Tip

In case connection errors occur, try the following to resolve:

  • Check if the Windows Defender Firewall on the FTP server allows the FTP port (21 in this tutorial) to go through.

  • Check if the port (21 in tutorial) is occupied by any other program.

    Tip: You can execute the command "netstat -ano | findstr 21" to check if the port number is occupied by any other program.

  • Input a username and password for logging to the FTP site, instead of using anonymous login.

  • Check if the user has read and write permissions to the FTP root.

Uploading the cloud app launcher and the runtime files to the remote server

Step 1: Select Tools>Upload Cloud App Launcher from the PowerBuilder menu bar.

Step 2: In the Upload Cloud App Launcher and Runtime window that appears, select Directly upload to the server and then select a server profile (for example, "Remote IIS Web Server") from the listbox.

Step 3: Keep the other settings as default and click Upload.


Step 4: When the upload is finished, go to the Web server and verify the "CloudAppPublisher" folder exists under the Web root (in this tutorial, the Web root for IIS is C:\inetpub\wwwroot, for Apache is C:\Apache24\htdocs, and for Nginx is C:\nginx-1.19.10\html).

Modifying and re-deploying the PowerServer project

The following modifications are made to the PowerServer project created in the Quick Start guide. If you have not created a PowerServer project yet, please follow the instructions in the Quick Start guide to create one.

Step 1: Select the profile for the remote server (instead of the local server).

On the Client Deployment tab of the PowerServer project painter, select "Directly deploy to the server" and then select a server profile (such as "Remote IIS Web Server", "Remote Apache HTTP Server", or "Remote Nginx") in the Deployment mode section.

The server profile is created in the section Creating a Web server profile for remote deployment.


Step 2: Specify the Web API URL. The Web API URL is used by the client app to call the Web APIs.

On the Web APIs tab of the PowerServer project painter, specify the Web API URL, for example, http://172.16.100.71:5009. This indicates that the client app will call the Web APIs running on the server at http://172.16.100.71:5009.

Important

  1. Make sure the Web API is running on the specified IP address (or host name) and port number. For how to start the Web API, see the next section.

  2. If the IP address and port number of the API server are changed later, you will need to modify the settings here and then deploy the project again (using the "Build & Deploy PowerServer Project" option).


Step 3: Select the ODBC data source.

At the bottom of the Web APIs tab of the PowerServer project painter, click the Database Configuration button.

In the Database Configuration dialog, click New in the upper part to create the database connection that will be used by the deployment.

Configure the database connection with the following settings:


Make sure the check box for the database cache you created just now is selected.

Then select the database cache you created just now to map with the "sqlca" transaction object.


Step 4: Save the PowerServer project settings.

Step 5: Build and deploy the PowerServer project (using the "Build & Deploy PowerServer Project" option) for the changes to take affect.

When the deployment is finished, go to the Web server and verify that the "pstutor_salesdemo_asa" folder exists under the Web root.

Step 6: Go to the specified location (C:\Users\appeon\source\repos in this tutorial) and copy the PowerServer solution folder to the API server.

Task 5: Setting up the API server

Preparations

In this tutorial, we will set up a Web API server running in an independent machine.

This tutorial starts the Web APIs in the debug mode, you can also deploy the Web APIs in a release mode and host it in a more secure and manageable environment such as Docker Container, IIS, Kestrel etc. as described in tutorial 2, 3, & 4.

Step 1: Set up the API server with the following OS and software:

  • Windows Server 2019 (64-bit)

  • SQL Anywhere 17

  • SnapDevelop 2021

Step 2: Make sure the API server can connect to the NuGet site: https://www.nuget.org (for installing PowerServer NuGet packages) and the following Appeon sites: https://apips.appeon.com, https://apipsoa.appeon.com, https://apipsinfo.appeon.com, and https://api.appeon.com (for validating the PowerServer license).

Step 3: Configure Windows Defender Firewall on the API server to allow the API server port (5009 in this tutorial or any port number you choose). The section "Configuring Windows Defender Firewall" has detailed instructions.

Creating the ODBC data source

A database connection needs to be established between the development PC and the database server (for converting DataWindows to models), and between the API server and the database server (for retrieving data). Currently the SQL Anywhere database can only be connected through an ODBC driver, therefore, you will need to create the same ODBC data source in both:

  • the development PC, and

  • the API server

Step 1: Install SQL Anywhere 17.

Step 2: Create a 64-bit ODBC data source and name it as "SalesDemo DB". The data source name must be the same in both the development PC and the API server. The data source should connect to the salesdemo SQL Anywhere database server (which is set up in Task 2: Setting up the database server).

IMPORTANT: Make sure you use the 64-bit version of ODBC administrator to create the data source, because only the 64-bit ODBC data sources are supported by PowerServer.

Step 3: Click Test Connection to ensure the connection settings are correct.



Publishing the Web APIs

Step 1: Copy the PowerServer Web API solution from the development PC (C:\Users\appeon\source\repos in this tutorial) to the API server.

Step 2: Double click PowerServerApp.sln to launch the solution in SnapDevelop. Log in to SnapDevelop if required.

The PowerServer Web API solution will connect to the NuGet site (https://www.nuget.org) to download and install the required packages from the NuGet site.

Step 3: Click Run from the SnapDevelop toolbar to start the Web APIs in the debug mode.

However, for optimal performance, it is recommended that you publish the Web APIs to a dedicated server and run the Web APIs in the release mode as described in