Document toolboxDocument toolbox

Install the PLC-CFX Gateway

Getting started: installation prerequisites


Important

At the time of this publication, the PLC-CFX Gateway installation consists of a series of manual procedures. The gateway installation should only be done by individuals who are highly experienced with SQL database configuration and SQL scripts. Experience with Microsoft SQL server Management Studio (SSMS), .NET 6, and the Windows PowerShell Integrated Scripting Environment (ISE) is also required to install the PLC-CFX Gateway.


Copy the gateway installation files to the target machine

  1. On the gateway target machine, create this folder:

    C:\Program Files (x86)\Aegis\PLCGateway\

  2. Copy the contents of the PLC-CFX Gateway Installation folder into the PLCGateway folder on the target machine.

Install the .NET 6 hosting bundle

Create and configure the SQL database

  1. Open Microsoft SQL Server Management Studio (SSMS)

  2. Create and name a new SQL database, for example PLC-CFX Gateway.
  3. Create a new user named AegisSQL.

Create ASP.NET core services

  1. Start Windows PowerShell ISE (select Run as Administrator). 

    Note:

    For more information about Windows Powershell ISE, see https://learn.microsoft.com/en-us/powershell/.

  2. Edit the following script by entering the appropriate details for the following line: $userName = "[ComputerNameOrDomain]\[UserName]"

    • Important

      Each numbered line in the following script should be entered as a single line of code.


    1  $exeFolder = "C:\Program Files (x86)\Aegis\PLCGateway\"

    2 $exePath = "C:\Program Files (x86)\Aegis\PLCGateway\Aegis.CFX.Gateway.Web.Server.exe"

    3 $userName = "[ComputerNameOrDomain]\[UserName]"

    4 $serviceName = "Aegis PLC Gateway Service"

    5 $serviceDesc = "IIoT Service Connecting PLCs to CFX enabled systems"

    6 $acl = Get-Acl $exeFolder

    7 $aclRuleArgs = $userName, "Read,Write,ReadAndExecute", "ContainerInherit,ObjectInherit", "None", "Allow"

    8 $accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule($aclRuleArgs)

    9 $acl.SetAccessRule($accessRule)

    10 $acl | Set-Acl $exeFolder

    11 New-Service -Name $serviceName -BinaryPathName ($exePath + " --contentRoot " + $exePath) -Credential $userName -Description $serviceDesc -DisplayName $serviceName -StartupType Automatic



  3. Save your changes.

  4. Execute the Powershell script and the Aegis PLC Gateway Service will be created.

    Note:

    If you see an error stating that the scripts can't run, use the  Set-ExecutionPolicy command to adjust the policy to allow scripts, for example:

    Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process

Create the database configuration

  1. Download and install the hosting bundle of the latest version of .NET 6 ASP.NET Core Runtime.
  2. Create a new local or domain user account with local administrator rights on the target machine (or use an existing FactoryLogix service account).
  3. Create the ‘CreateASPNETCoreServices’.
  4. Right-click PLCGateway\AegisCFXGateway.pfx, then select Install PFX.
  5. Select Local Machine.
  6. Select Use Password GatewayAdmin123* .
  7. Select “Place Certificate in the Following Store…”, select “Trusted Root Certification Authorities”, then finish the wizard.
  8. Edit the appsetttings.json file in PLCGateway folder (see the following topic).
  9. Set the database connection string and PLCCFXGateway Server details.
  10. Go to services.msc to open the Services window.
  11. Right-click the Aegis PLC Gateway Service and select Start to start the service.
  12. Open a browser and navigate to https://localhost:5251.
  13. Log in using the following credentials:

    ID:
    admin
    password: GatewayAdmin123*

Configure the appsetting.json file

  1. Open the appsettings.json file located in the PLC-CFX Gateway installation folder.
  2. Replace the bold items in square brackets [ ] as shown below:

    {
      /*
    The following identity settings need to be configured
    before the project can be successfully executed.
    For more info see https://aka.ms/dotnet-template-ms-identity-platform
    */
      "IdentityServer": {
        "Key": {
          "Type": "File",
          "FilePath": "AegisCFXGateway.pfx",
          "Password": "GatewayAdmin123*"
        },
        "Clients": {
          "Aegis.CFX.Gateway.Web.Client": {
            "Profile": "IdentityServerSPA"
          }
        }
      },
      "ConnectionStrings": {
        "DefaultConnection": "Server=[DB Server];Database=[DB Name];MultipleActiveResultSets=True;User Id=[Username];Password=[Password];",
      },
      "Logging": {
        "LogLevel": {
          "Default": "Trace",
          "Microsoft": "Warning",
          "Microsoft.Hosting.Lifetime": "Information"
        }
      },
      "AllowedHosts": "*",
      "Kestrel": {
        "Endpoints": {
          "Http": {
            "Url": "http://[PLCCFXGatewayServer]:5250"
          },
          "HttpsInlineCertFile": {
            "Url": "https://[PLCCFXGatewayServer]:5251",
            "Certificate": {
              "Path": "AegisCFXGateway.pfx",
              "Password": "GatewayAdmin123*"
            }
          },
        }
      },
      "PagingData": {
        "PageSize": 25
      }
    }



  3. Save your changes.



Copyright © 2024 Aegis Industrial Software Corporation. All Rights Reserved.