1. Information

1.2. GitHub

  • The source code of the new ANC application is hosted on GitHub under the SMRU account in the PMS-App repository.

  • The project uses CI/CD, which stands for Continuous Integration and Continuous Delivery/Deployment.

  • The 3BB Huawei HG8145V5 broadband router, forwards ports 2222 and 2223 to the SMRU-SFW-MKT Sophos firewall.

  • The 3BB Huawei HG8145X6 broadband router, forwards ports 2222 and 2223 to the SMRU-SFW-TST Sophos firewall.

  • The SMRU-SFW-MKT Sophos firewall, forwards port 2222 to port 22 at the TBHF-ANC-MKT ANC server.

  • The SMRU-SFW-MKT Sophos firewall, forwards port 2223 to port 22 at the SMRU-PMS-MKT PMS server.

  • The SMRU-SFW-TST Sophos firewall, forwards port 2222 to port 22 at the TBHF-ANC-TST ANC server.

  • The SMRU-SFW-TST Sophos firewall, forwards port 2223 to port 22 at the SMRU-PMS-TST PMS server.

  • The SMRU-SFW-MRM Sophos firewall, forwards port 2222 to port 22 at the TBHF-ANC-SKK ANC server.

  • The SMRU-SFW-MRM Sophos firewall, forwards port 2223 to port 22 at the SMRU-PMS-SKK PMS server.

    delta@tbhf-anc-tst ~$   ssh -i ~delta/id_rsa-auto -p 2222 delta@smru-sfw-mrm.dyndns.org hostname                        # tbhf-anc-skk
    delta@tbhf-anc-tst ~$   ssh -i ~delta/id_rsa-auto -p 2223 Administrator@smru-sfw-mrm.dyndns.org set computername        # COMPUTERNAME=SMRU-PMS-SKK
    delta@tbhf-ops-mrm ~$   ssh -i ~delta/id_rsa-auto -p 2222 delta@smru-sfw-tst.dyndns.org hostname                        # tbhf-anc-tst
    delta@tbhf-ops-mrm ~$   ssh -i ~delta/id_rsa-auto -p 2223 Administrator@smru-sfw-mkt.dyndns.org set computername        # COMPUTERNAME=SMRU-PMS-MKT
    delta@tbhf-ops-mrm ~$   ssh -i ~delta/id_rsa-auto -p 2223 Administrator@smru-sfw-tst.dyndns.org set computername        # COMPUTERNAME=SMRU-PMS-TST
  • There are three important GitHub workflow files.

  • See https://docs.github.com/en/actions/managing-workflow-runs-and-deployments/managing-workflow-runs/manually-running-a-workflow.

  • See https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#workflow_dispatch.

cd-develop.yml
branches:
  - develop

run: dotnet publish ./Pms.Server/Pms.Server.csproj -o ./output

host: smru-sfw-tst.dyndns.org
username: Administrator
port: 22222
key: ${{ secrets.SMRU_PRIVATE_SSH_KEY }}
source: "./Pms/output,!./Pms/output/appsettings*.json"
target: "C:/PMS"
cd-mkt.yml
branches:
  - main

run: dotnet publish ./Pms.Server/Pms.Server.csproj -o ./output

host: smru-sfw-mkt.dyndns.org
username: Administrator
port: 22222
key: ${{ secrets.SMRU_PRIVATE_SSH_KEY }}
source: "./Pms/output,!./Pms/output/appsettings*.json"
target: "C:/PMS"
cd-mrm.yml
branches:
  - main

run: dotnet publish -c Release -r linux-x64 --self-contained true ./Pms.Server/Pms.Server.csproj -o ./output

host: smru-sfw-mrm.dyndns.org
username: smru
port: 22223
key: ${{ secrets.SMRU_PRIVATE_SSH_KEY }}
source: "./Pms/output,!./Pms/output/appsettings*.json"
target: "/var/www/aspnetcore/pms-app"

The SMRU private SSH key is located at PMS-App > Settings > Secrets and variables > Actions > Secrets.

  • Enter the following commands at a Command Line on TBHF-ANC-MRM.

    cd ~delta/github/git/delta-sotware-labs/Documentation
     cd ..
    git clone https://delta-software-labs@github.com/delta-software-labs/PMS-App.git
     cd Pms-App/Pms
     cd Pms.Server

1.3. Linux Debian Servers

  • Note: Make sure to add W:\Software\_Delta\id_rsa-auto.pub to ~root/.ssh/authorized_keys.

  • Note: Make sure to add W:\Software\_Delta\id_rsa-auto.pub to ~delta/.ssh/authorized_keys.

    cat id_rsa-auto.pub >> ~root/.ssh/authorized_keys
    cat id_rsa-auto.pub >> ~delta/.ssh/authorized_keys
    cat ~root/.ssh/authorized_keys
    cat ~delta/.ssh/authorized_keys
    sudo service ssh restart
    sudo service ssh status
    TBHF-ANC-MRM    10.10.1.2       Debian 8.11     /home/delta/.ssh/authorized_keys # Empty.
    TBHF-OPS-MRM    10.10.1.4       Debian 12.10    /home/delta/.ssh/authorized_keys # ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDD...
    TBHF-ANC-SKK    10.10.1.222     Debian 11.11    /home/delta/.ssh/authorized_keys # ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDD...
    TBHF-ANC-TST    10.30.1.2       Debian 11.11    /home/delta/.ssh/authorized_keys # ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDD...
    ssh -i ~delta/id_rsa-auto delta@tbhf-anc-mkt
    # Error: sign_and_send_pubkey: no mutual signature supported
    ssh -i ~delta/id_rsa-auto -o PubkeyAcceptedKeyTypes=ssh-rsa delta@tbhf-anc-mkt

1.4. Mawkerthai Environment

  • The SMRU-SFW-MKT Sophos firewall, forwards port 2222 to port 22 at the TBHF-ANC-MKT ANC server.

  • The SMRU-SFW-MKT Sophos firewall, forwards port 2223 to port 22 at the SMRU-PMS-MKT PMS server.

    SSH from GitHub to TBHF-ANC-MKT, , Incoming traffic, WAN, Any, All the time, LAN, #Port2, "TCP 2222"
    SSH from GitHub to SMRU-PMS-MKT, , Incoming traffic, WAN, Any, All the time, LAN, #Port2, "TCP 2223"
    
    SSH from GitHub to TBHF-ANC-MKT, , Any, #Port2, "TCP 2222", Original, "TBHF-ANC-MKT", "TCP 22", Port2-WAN, Any
    SSH from GitHub to SMRU-PMS-MKT, , Any, #Port2, "TCP 2223", Original, "SMRU-PMS-MKT", "TCP 22", Port2-WAN, Any
  • Enter the following commands at a Command Line on TBHF-OPS-MRM, inside private LAN.

    ls -al ~delta/id_rsa-auto       # -rw------- 1 delta delta 1679 2022-07-20 07:43:44 /home/delta/id_rsa-auto     # tbhf-anc-mrm
    ls -al ~delta/id_rsa-auto       # -rw------- 1 delta delta 1679 May  6  2015 /home/delta/id_rsa-auto            # tbhf-ops-mrm
    ssh -i ~delta/id_rsa-auto -p 22    Administrator@SMRU-PMS-MKT set computername                  # COMPUTERNAME=SMRU-PMS-MKT     # Can have DNS issue on tbhf-ops-mrm.
  • Enter the following commands at a Command Line on TBHF-ANC-TST outside private LAN.

    ls -al ~delta/id_rsa-auto       # -rw------- 1 delta delta 1679 2025-04-01 07:34:53 /home/delta/id_rsa-auto     # tbhf-anc-tst
    ssh -i ~delta/id_rsa-auto -p 2223 Administrator@smru-sfw-mkt.dyndns.org set computername        # COMPUTERNAME=SMRU-PMS-MKT

1.5. Production Environment

  • The SMRU-SFW-MRM Sophos firewall, forwards port 2222 to port 22 at the TBHF-ANC-SKK ANC server.

  • The SMRU-SFW-MRM Sophos firewall, forwards port 22225 to port 22 at the TBHF-HyperV01 Windows Server 2025.

    SSH from GitHub to TBHF-ANC-SKK, , Incoming traffic - LAN, WAN, Any, All the time, LAN, #Port2, "TCP 2222"
    TBHF-HyperV01, , Incoming traffic - LAN, WAN, Any, All the time, LAN, #Port2, "TCP 22225"
    
    SSH from GitHub to TBHF-ANC-SKK, , Any, #Port2, "TCP 2222", Original, "TBHF-ANC-SKK", TCP 22, WAN, Any
    Allow SSH access to TBHF-HyperV01 using 22225, , Any, #Port2, "TCP 22225", Original, "TBHF-HyperV01", TCP 22, WAN, Any
  • Enter the following commands at a Command Line on TBHF-OPS-MRM, inside private LAN.

    ls -al ~delta/id_rsa-auto       # -rw------- 1 delta delta 1679 2022-07-20 07:43:44 /home/delta/id_rsa-auto     # tbhf-anc-mrm
    ls -al ~delta/id_rsa-auto       # -rw------- 1 delta delta 1679 May  6  2015 /home/delta/id_rsa-auto            # tbhf-ops-mrm
    ssh -i ~delta/id_rsa-auto -p 22    delta@tbhf-anc-skk hostname                                  # tbhf-anc-skk
    ssh -i ~delta/id_rsa-auto -p 22    Administrator@TBHF-HYPERV01 set computername                 # COMPUTERNAME=TBHF-HYPERV01    # Can have DNS issue on tbhf-ops-mrm.
    ssh -i ~delta/id_rsa-auto -p 22    Administrator@10.10.1.203 set computername                   # COMPUTERNAME=TBHF-HYPERV01
  • Enter the following commands at a Command Line on TBHF-ANC-TST outside private LAN.

    ls -al ~delta/id_rsa-auto       # -rw------- 1 delta delta 1679 2025-04-01 07:34:53 /home/delta/id_rsa-auto     # tbhf-anc-tst
    ssh -i ~delta/id_rsa-auto -p 2222 delta@smru-sfw-mrm.dyndns.org hostname                        # tbhf-anc-skk
    ssh -i ~delta/id_rsa-auto -p 22225 Administrator@smru-sfw-mrm.dyndns.org set computername       # COMPUTERNAME=TBHF-HYPERV01

1.6. Test Environment

  • The SMRU-SFW-TST Sophos firewall, forwards port 2222 to port 22 at the TBHF-ANC-TST ANC server.

  • The SMRU-SFW-TST Sophos firewall, forwards port 2223 to port 22 at the SMRU-PMS-TST PMS server.

    SSH from GitHub to TBHF-ANC-TST, , Incoming traffic - LAN, WAN, Any, All the time, LAN, #Port2, "TCP 2222"
    SSH from GitHub to SMRU-PMS-TST, , Incoming traffic - LAN, WAN, Any, All the time, LAN, #Port2, "TCP 2223"
    
    SSH from GitHub to TBHF-ANC-TST, , Any, #Port2, "TCP 2222", Original, "TBHF-ANC-TST", "TCP 22", WAN-Port2, Any
    SSH from GitHub to SMRU-PMS-TST, , Any, #Port2, "TCP 2223", Original, "SMRU-PMS-TST", "TCP 22", WAN-Port2, Any
  • Enter the following commands at a Command Line on TBHF-ANC-TST, inside private LAN.

    ssh -i ~delta/id_rsa-auto -p 22 Administrator@SMRU-PMS-TST set computername     # COMPUTERNAME=SMRU-PMS-TST
    ssh -i ~delta/id_rsa-auto -p 22 delta@TBHF-ANC-TST hostname                     # tbhf-anc-tst
  • Enter the following commands at a Command Line on TBHF-OPS-MRM, outside private LAN.

    ssh -i ~delta/id_rsa-auto -p 2222 delta@smru-sfw-tst.dyndns.org hostname                                # tbhf-anc-tst
    ssh -i ~delta/id_rsa-auto -p 2223 Administrator@smru-sfw-tst.dyndns.org set computername        # COMPUTERNAME=SMRU-PMS-TST
  • The new ANC application is deployed in the Test Environment.

  • The Test Environment consists of:

    • A 3BB Huawei HG8145X6 broadband router.

    • A SMRU-SFW-TST Sophos XG135 20.0.3 firewall.

    • A SMRU-SRV-TST Windows Server 2019 Standard (1809).

    • A SMRU-PMS-TST Windows 10 Enterprise (22H2).

    • A TBHF-ANC-TST Linux Debian 11.11 server.

  • To access the new ANC Application, browse to http://smru-sfw-tst.dyndns.org:8000.

  • To access the new ANC Application, browse to http://10.10.1.222:5000.

  • To access the new ANC Application, browse to http://10.10.1.222:5000/wwwroot.

  • The 3BB Huawei HG8145X6 broadband router, forwards ports 8000, 8001, 2222 and 2223 to the SMRU-SFW-TST Sophos firewall.

  • The SMRU-SFW-TST Sophos firewall has the following port forwarding configuration.

Name                            Original        Host            Translated
----                            --------        ----            ----------
WebServer DNAT                  80              SMRU-PMS-TST    80
WebServer DNAT                  8000            SMRU-PMS-TST    8000
WebServer DNAT                  8001            SMRU-PMS-TST    8001
SSH from GitHub to TBHF-ANC-TST 2222            TBHF-ANC-TST    22
SSH from GitHub to SMRU-PMS-TST 2223            SMRU-PMS-TST    22

The SMRU-PMS-TST PMS server has Internet Information Services installed and is configured for port 8000.

2. Linux

  • Sign in as smru on the TBHF-ANC-SKK ANC server.

2.1. Microsoft .NET 8.0.12 Runtime

  • See https://learn.microsoft.com/en-us/dotnet/core/install/linux-debian?tabs=dotnet8.

    wget https://packages.microsoft.com/config/debian/11/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
    sudo dpkg -i packages-microsoft-prod.deb
    
    dpkg -L packages-microsoft-prod
    sudo apt-get update
    sudo apt-get install -y aspnetcore-runtime-8.0
    sudo apt-get install -y dotnet-sdk-8.0
    
    which dotnet
    dotnet --info
    /usr/bin/dotnet
    Host:
      Version:      8.0.12
      Architecture: x64
      Commit:       89ef51c5d8
      RID:          linux-x64
    
    .NET SDKs installed:
      No SDKs were found.
    
    .NET runtimes installed:
      Microsoft.AspNetCore.App 8.0.12 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
      Microsoft.NETCore.App 8.0.12 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
    
    Other architectures found:
      None
    
    Environment variables:
      Not set
    
    global.json file:
      Not found
    
    Learn more:
      https://aka.ms/dotnet/info
    
    Download .NET:
      https://aka.ms/dotnet/download

2.2. ApacheDotNet

  • See https://www.yogihosting.com/aspnet-core-host-apache-linux.

    # Create ASP.NET Core App.
    cd
    dotnet new mvc --name ApacheDotNet
    cd ApacheDotNet
    cp -a Program.cs Program.cs.org
    # Make required changes to Program.cs.
    vi Program.cs
    diff Program.cs.org Program.cs
    dotnet build
    dotnet publish --configuration Release
    cd bin/Release/net8.0/publish
    ls -al
    dotnet ApacheDotNet.dll
    info: Microsoft.Hosting.Lifetime[14]
          Now listening on: http://localhost:5000
    info: Microsoft.Hosting.Lifetime[0]
          Application started. Press Ctrl+C to shut down.
    info: Microsoft.Hosting.Lifetime[0]
          Hosting environment: Production
    info: Microsoft.Hosting.Lifetime[0]
          Content root path: /home/delta/ApacheDotNet/bin/Release/net8.0/publish
    curl http://localhost:5000
    sudo mkdir /var/www/apachedotnet
    sudo cp -r . /var/www/apachedotnet
    ls -al /var/www/apachedotnet
  • Contents of the /etc/systemd/system/kestrel-apachedotnet.service file.

    [Unit]
    Description=Apache DOT NET App
    
    [Service]
    WorkingDirectory=/var/www/apachedotnet
    ExecStart=/usr/bin/dotnet /var/www/apachedotnet/ApacheDotNet.dll
    Restart=always
    # Restart service after 10 seconds if the dotnet service crashes:
    RestartSec=10
    KillSignal=SIGINT
    SyslogIdentifier=apachedotnet
    User=www-data
    Environment=ASPNETCORE_ENVIRONMENT=Production
    
    [Install]
    WantedBy=multi-user.target
    sudo systemctl enable kestrel-apachedotnet.service
    sudo systemctl start kestrel-apachedotnet.service
    sudo systemctl status kestrel-apachedotnet.service
    # Apache
    sudo apt install apache2
    sudo service apache2 status
    sudo service apache2 restart
    sudo service apache2 start
    sudo service apache2 stop
    
    # Enable headers, proxy and proxy_http modules of Apache.
    sudo a2enmod headers
    sudo a2enmod proxy
    sudo a2enmod proxy_http
    sudo service apache2 restart
  • Contents of the /etc/apache2/sites-available/apachedotnet.conf file.

    <VirtualHost *:*>
        RequestHeader set "X-Forwarded-Proto" expr=%{REQUEST_SCHEME}
    </VirtualHost>
    
    <VirtualHost *:80>
        ProxyPreserveHost On
        ProxyPass / http://127.0.0.1:5000/
        ProxyPassReverse / http://127.0.0.1:5000/
        ServerName  localhost
        ServerAlias *.localhost
        ErrorLog ${APACHE_LOG_DIR}/apachedotnet.log
        CustomLog ${APACHE_LOG_DIR}/apachedotnet.log common
    </VirtualHost>
    sudo ln -s /etc/apache2/sites-available/apachedotnet.conf /etc/apache2/sites-enabled/apachedotnet.conf
    sudo service apache2 restart

2.3. Git

  • Enter the following commands at a Command Line.

    cd
    git clone https://delta-software-labs@github.com/delta-software-labs/PMS-App.git
    cd PMS-App/Pms/Pms.Server
    dotnet build
    ls -al bin/Debug/net8.0
    dotnet publish --configuration Release
    ls -al bin/Release/net8.0/publish
    bin/Release/net8.0/publish/Pms.Server
    cd bin/Release/net8.0/publish
    dotnet Pms.Server.dll
    info: Microsoft.Hosting.Lifetime[14]
          Now listening on: http://localhost:5000
    info: Microsoft.Hosting.Lifetime[0]
          Application started. Press Ctrl+C to shut down.
    info: Microsoft.Hosting.Lifetime[0]
          Hosting environment: Production
    info: Microsoft.Hosting.Lifetime[0]
          Content root path: /home/delta/PMS-App/Pms/Pms.Server/bin/Release/net8.0/publish
    warn: Microsoft.AspNetCore.HttpsPolicy.HttpsRedirectionMiddleware[3]
          Failed to determine the https port for redirect.
    curl http://localhost:5000
    <!doctype html>
    <html lang="en">
    <head>
        <meta charset="UTF-8" />
        <link rel="icon" type="image/svg+xml" href="/vite.svg" />
        <link rel="stylesheet"
              href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css"
              integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN"
              crossorigin="anonymous" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>ANC Application</title>
      <script type="module" crossorigin src="/assets/index-x6MrD7tv.js"></script>
      <link rel="stylesheet" crossorigin href="/assets/index--RKW_4Bi.css">
    </head>
      <body>
        <div id="root"></div>
      </body>
    </html>
    sudo mkdir /var/www/pmsserver
    sudo cp -r . /var/www/pmsserver
    ls /var/www/pmsserver
  • Contents of the /etc/systemd/system/kestrel-pmsserver.service file.

    [Unit]
    Description=Apache DOT NET App
    
    [Service]
    WorkingDirectory=/var/www/pmsserver
    ExecStart=/usr/bin/dotnet /var/www/pmsserver/Pms.Server.dll
    Restart=always
    # Restart service after 10 seconds if the dotnet service crashes:
    RestartSec=10
    KillSignal=SIGINT
    SyslogIdentifier=pmsserver
    User=www-data
    Environment=ASPNETCORE_ENVIRONMENT=Production
    
    [Install]
    WantedBy=multi-user.target
    sudo systemctl enable kestrel-pmsserver.service
    sudo systemctl start kestrel-pmsserver.service
    sudo systemctl status kestrel-pmsserver.service

2.4. File System

  • Note: Create the C:\PMS folder, otherwise the cd-smru-pms-<site>.yml GitHub workflow fails.

  • Type ls -al /var/www/aspnetcore/pms-app and press Enter.

  • Type ls -al /var/www/aspnetcore/pms-app/Pms/output and press Enter.

  • Type ls -al /var/www/aspnetcore/pms-app/Pms/output/wwwroot and press Enter.

  • Backup the /var/www/aspnetcore/pms-app/Pms/output/appsettings.json file to /var/www/aspnetcore/pms-app/Pms/output/appsettings.json.org.

  • Copy the C:\PMS\Pms\output\appsettings.json file from SMRU-PMS-TST to the /var/www/aspnetcore/pms-app/Pms/output folder on TBHF-ANC-SKK.

  • Change Server=10.30.1.2 to Server=10.10.1.2.

  • Change Database=anc-mkt to Database=anc-active.

  • Restart Apache2.

    sudo service nginx stop
    sudo service nginx disable
    sudo service apache2 restart
    sudo service apache2 status
    
    cat /var/www/aspnetcore/pms-app/Pms/output/appsettings.json
    
    # Make sure that Apache2 is not using port 5000.
    cd /var/www/aspnetcore/pms-app/Pms/output
    ./Pms.Server
    {
      "ConnectionStrings": {
        "PmsDbConnection": "Server=10.10.1.2;Port=5432;Database=anc-active; User Id=smru;Password=d2h2mqqa;"
      }
    }
    info: Microsoft.AspNetCore.Mvc.Infrastructure.DefaultActionDescriptorCollectionProvider[1]
          No action descriptors found. This may indicate an incorrectly configured application or missing application parts. To learn more, visit https://aka.ms/aspnet/mvc/app-parts
    info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[62]
          User profile is available. Using '/home/delta/.aspnet/DataProtection-Keys' as key repository; keys will not be encrypted at rest.
    info: Microsoft.Hosting.Lifetime[14]
          Now listening on: http://localhost:5000
    info: Microsoft.Hosting.Lifetime[0]
          Application started. Press Ctrl+C to shut down.
    info: Microsoft.Hosting.Lifetime[0]
          Hosting environment: Production
    info: Microsoft.Hosting.Lifetime[0]
          Content root path: /var/www/aspnetcore/pms-app/Pms/output
    curl http://localhost:5000

+

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <link rel="icon" type="image/svg+xml" href="/vite.svg" />
    <link rel="stylesheet"
          href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css"
          integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN"
          crossorigin="anonymous" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>ANC Application</title>
  <script type="module" crossorigin src="/assets/index-x6MrD7tv.js"></script>
  <link rel="stylesheet" crossorigin href="/assets/index--RKW_4Bi.css">
</head>
  <body>
    <div id="root"></div>
  </body>
</html>

2.5. Apache

  • See https://www.yogihosting.com/aspnet-core-host-apache-linux.

    sudo service apache2 status
    sudo service apache2 restart
    sudo service apache2 start
    sudo service apache2 stop
    
    # Enable headers, proxy and proxy_http modules of Apache.
    sudo a2enmod headers
    sudo a2enmod proxy
    sudo a2enmod proxy_http
    sudo service apache2 restart
  • Contents of the /etc/apache2/sites-available/pmsserver.conf file.

    <VirtualHost *:*>
        RequestHeader set "X-Forwarded-Proto" expr=%{REQUEST_SCHEME}
    </VirtualHost>
    
    <VirtualHost *:80>
        ProxyPreserveHost On
        ProxyPass / http://127.0.0.1:5000/
        ProxyPassReverse / http://127.0.0.1:5000/
        ServerName  localhost
        ServerAlias *.localhost
        ErrorLog ${APACHE_LOG_DIR}/pmsserver.log
        CustomLog ${APACHE_LOG_DIR}/pmsserver.log common
    </VirtualHost>
    # Configure Apache for .NET app.
    sudo ln -s /etc/apache2/sites-available/pmsserver.conf /etc/apache2/sites-enabled/pmsserver.conf
    sudo apachectl configtest
    sudo service apache2 restart
  • Sign in as smru on the TBHF-ANC-SKK ANC server.

2.6. Usage

3. Windows

  • Sign in as Administrator on the SMRU-PMS-MKT PMS server.

  • Sign in as Administrator on the SMRU-PMS-TST PMS server.

3.1. IIS

3.2. Microsoft .NET Runtime - 8.0.14 (x64)

3.3. Microsoft ASP.NET Core 8.0.14 - Shared Framework (x64)

  • Browse to https://dotnet.microsoft.com/en-us/download/dotnet/8.0.

  • Select 8.0.14 > ASP.NET Core Runtime 8.0.14 > Windows > x64.

  • Run the aspnetcore-runtime-8.0.14-win-x64.exe with administrative privileges.

  • Check I agree to the license terms and conditions.

  • Click Install.

  • Click Close.

3.4. Microsoft .NET 8.0.14 - Windows Server Hosting

  • Browse to https://dotnet.microsoft.com/en-us/download/dotnet/8.0.

  • Select 8.0.14 > ASP.NET Core Runtime 8.0.14 > Windows > Hosting Bundle.

  • Run the dotnet-hosting-8.0.14-win.exe with administrative privileges.

  • Check I agree to the license terms and conditions.

  • Click Install.

  • Click Close.

    where dotnet
    dotnet.exe --info
    C:\Program Files\dotnet\dotnet.exe
    Host:
      Version:      8.0.14
      Architecture: x64
      Commit:       1584e49360
      RID:          win-x64
    
    .NET SDKs installed:
      No SDKs were found.
    
    .NET runtimes installed:
      Microsoft.AspNetCore.App 8.0.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
      Microsoft.NETCore.App 8.0.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
    
    Other architectures found:
      x86   [C:\Program Files (x86)\dotnet]
        registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
    
    Environment variables:
      Not set
    
    global.json file:
      Not found
    
    Learn more:
      https://aka.ms/dotnet/info
    
    Download .NET:
      https://aka.ms/dotnet/download

3.5. .NET Framework 4.8

  • Sign in as Administrator on the SMRU-PMS-MKT PMS server.

  • Sign in as Administrator on the SMRU-PMS-TST PMS server.

  • Open Control Panel | Programs and Features.

  • Select Turn Windows features on or off.

  • Expand .NET Framework 4.8 Advanced Services.

  • Check ASP.NET 4.8.

  • Click OK.

  • Click Close.

3.6. File System

  • Sign in as Administrator on the SMRU-PMS-MKT PMS server.

  • Sign in as Administrator on the SMRU-PMS-TST PMS server.

  • Type dir C:\PMS and press Enter.

  • Type dir C:\PMS\Pms\output and press Enter.

  • Type dir C:\PMS\Pms\output\wwwroot and press Enter.

  • Start File Explorer.

  • Select the C:\PMS\Pms\output folder.

  • Close File Explorer.

    type C:\PMS\Pms\output\appsettings.json
    type C:\PMS\Pms\output\clinic.json
    {
      "Logging": {
        "LogLevel": {
          "Default": "Information",
          "Microsoft.AspNetCore": "Warning"
        }
      },
      "AllowedHosts": "*",
      "ConnectionStrings": {
        "PmsDbConnection": "Server=10.30.1.2;Port=5432;Database=anc-mkt; User Id=smru;Password=d2h2mqqa;"
      },
      "Authentication": {
        "DefaultScheme": "LocalAuthIssuer",
        "Schemes": {
          "Bearer": {
            "ValidAudiences": [
              "https://localhost:7259",
              "http://localhost:5259"
            ],
            "ValidIssuer": "dotnet-user-jwts"
          },
          "LocalAuthIssuer": {
            "ValidAudiences": [
              "https://localhost:7259",
              "http://localhost:5259"
            ],
            "ValidIssuer": "local-auth"
          }
        }
      },
      "Jwt": {
        "Issuer": "http://10.30.1.6/",
        "Audience": "http://10.30.1.6/",
        "Key": "cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e"
      }
    }
    {
      "Settings": {
        "Clinic": "MKT"
      }
    }
  • Copy the C:\PMS\Pms\output\appsettings.json file from SMRU-PMS-TST to the C:\PMS\Pms\output folder on SMRU-PMS-MKT*.

  • Change Server=10.30.1.2 to Server=192.168.25.2.

3.7. IIS Configuration

  • Sign in as Administrator on the SMRU-PMS-MKT PMS server.

  • Sign in as Administrator on the SMRU-PMS-TST PMS server.

  • Start Internet Information Services (IIS) Manager.

    • Select Start > Control Panel > Administrative Tools > Internet Information Services (IIS) Manager.

  • Right-click SMRU-PMS-TST > Application Pools and select Add Application Pool.

  • Type PmsApp in the Name field.

  • Select .NET CLR version: | No Managed Code.

  • Select Managed pipeline mode | Integrated.

  • Check Start application pool immediately.

  • Click OK.

  • Right-click SMRU-PMS-TST > Sites > Default Web Site and select Rename.

  • Type PmsApp and press Enter.

  • Select SMRU-PMS-TST > Sites > PmsApp.

  • Select Bindings.

  • Change Port from 80 to port 8000.

  • Click Close.

  • Select Basic Settings.

  • Change Physical path from %SystemDrive%\inetpub\wwwroot to C:\PMS\Pms\output.

  • Click OK.

  • Select Advanced Settings.

  • Change Application Pool from DefaultAppPool to PmsApp.

  • Close Internet Information Services (IIS) Manager.

  • Right-click SMRU-PMS-TST > Sites > PmsApp and select Manage Website > Start.

reg.exe delete HKLM\SYSTEM\CurrentControlSet\Services\WAS\Parameters /v GenerateKeys /f
net.exe start w3svc

3.8. Usage

  • Type Administrator in the Login field..

  • Type the SMRU ANC Application - Administrator password stored in the KeePass Password Manager in the Password field.

  • Click Log in.

4. Deployment

4.1. Windows

  • Note: Need to install Visual Studio.

  • Note: Make sure your installation of Visual Studio includes ASP.NET and web development and Node.js development.

  • Note: On date May 2025, by default Visual Studio will install .NET 8.0 Runtime. If not please install it.

  • Start Visual Studio.

  • Select Clone a repository.

  • Paste in the https://smru-dm@github.com/smru-dm/PMS-App.git in the Repository location field.

  • Click …​ to choose the project location you like to store.

  • Click Clone.

  • In Solution Explorer, right-click Pms.Server and select Publish.

  • Optional: Select New profile.

    • Choose Folder.

    • Click Next.

    • Click Browse.

    • Select C:\Tmp\Publish and click Open.

    • Click Finish.

    • Click Close.

  • Note: Always cleanup the target folder.

  • Click Show all settings.

    Configuration:          Release
    Target Framework:       net8.0
    Deployment Mode:        Framework-dependent
    Target Runtime:         Portable
  • Click Publish.

  • Copy the Build/Publish files/folders to the smru-anc-frl server.

  • Enter the following commands at a Command Line.

    scp -r C:\Tmp\Publish\* delta@10.10.1.252:/home/delta/publish/pmsapp

4.2. Linux

  • Log in as smru on the TBHF-ANC-FRL server.

  • Enter the following commands at a Command Line.

    mkdir -p publish/pmsapp
    
    #cd git
    #git clone https://smru-dm@github.com/smru-dm/PMS-App.git
    #cd PMS-App/Pms/Pms.Server
    #dotnet publish -c Release -o /home/delta/publish/pmsapp