Skip to content

Windows service

CONNECT can run as a Windows service: it starts with the PC, needs no logged-in user and no tray icon, and the Service Control Manager restarts it after a crash. Use it for an edge PC, a server or a customer machine that nobody logs on to.

Tray appWindows service
StartsWhen a user starts itWith Windows, before any logon
Needs a logged-in userYesNo
Runs asThe logged-in userNT SERVICE\realvirtual-connect (account LocalService, minimal privileges)
Configuration and licence%PROGRAMDATA%\realvirtual\CONNECTC:\ProgramData\realvirtual-connect-service\config
Self-updateYesNo - you replace the files, see Update
Headless mode, tray menu, dialogsYesNot available

The service has its own folder and shares nothing with a tray installation on the same PC. A tray CONNECT keeps working beside it, but not on the same port.

How CONNECT runs as a service: when Windows starts, the Service Control Manager starts the service realvirtual-connect without a user logon and restarts it after a crash. The service runs as NT SERVICE\realvirtual-connect (LocalService, minimal privileges), may only read and execute the program folder, has full control of the config, licence and data folders under C:\ProgramData\realvirtual-connect-service, and listens on 127.0.0.1:5100, where the browser HMI and AI clients on the same PC connect. Other PCs reach it only through a reverse proxy or with --bind 0.0.0.0 and an API key

  • Windows 10 or 11, 64-bit.

  • An elevated terminal (Run as administrator) for install and uninstall. status works without elevation.

  • Both executables from the same delivery, side by side in one folder: realvirtual-Connect.exe and realvirtual-connect-cli.exe. The installer refuses a mismatched pair.

    For the tray app one file is enough. The service needs the second one: realvirtual-connect-cli.exe is a small console program through which the service and license commands print their output and exit codes in the terminal. Download both files of the current release:

    The update button inside the app does not help here: it only replaces the program file of a tray installation in a writable folder and does not bring the console file.

  • A program folder that only administrators can write to, for example C:\Program Files\realvirtual CONNECT. Do not run the service from Downloads or a user profile.

  • A free port, 5100 by default.

  • A licence for the machine, see Licensing under the service.

  1. Create the folder and copy both executables into it.

    Terminal window
    New-Item -ItemType Directory "C:\Program Files\realvirtual CONNECT"
    Copy-Item .\realvirtual-Connect.exe, .\realvirtual-connect-cli.exe "C:\Program Files\realvirtual CONNECT"
  2. Install the service from an elevated terminal.

    Terminal window
    & "C:\Program Files\realvirtual CONNECT\realvirtual-Connect.exe" service install

    The installer checks the folders, creates the service folder, unpacks the converter tools, registers the service with automatic start and starts it. It reports success once the service is RUNNING. The start can take up to two minutes.

  3. Check the result.

    Terminal window
    & "C:\Program Files\realvirtual CONNECT\realvirtual-Connect.exe" service status
    Invoke-RestMethod http://127.0.0.1:5100/health
  4. Activate a licence.

OptionDefaultMeaning
--name <name>realvirtual-connectService name. Letters, digits, _, ., -; up to 80 characters; starts with a letter or digit
--port <port>5100Gateway port, 1 to 65535
--bind 127.0.0.1|0.0.0.0127.0.0.1Listener address. Only these two values are accepted. 0.0.0.0 makes the gateway reachable from the network
--config-dir <dir>C:\ProgramData\realvirtual-connect-service\configFolder of connect-config.json
--license-dir <dir>the default config folderFolder of the activated licence. If you set --config-dir, set --license-dir too unless you want the licence in the default folder
--data-dir <dir>C:\ProgramData\realvirtual-connect-service\dataModels, converted CAD, logs
--allow-writable-binary-diroffAccept a program folder that non-administrators can write to. See Security
--jsonoffMachine-readable output for install, uninstall and status

The directory options must point to a folder on a local fixed drive; UNC paths and device paths are refused. Choose dedicated folders, not system folders and not the tray folder %PROGRAMDATA%\realvirtual.

Example for a second instance on another port, reachable from the network:

Terminal window
realvirtual-Connect.exe service install --name realvirtual-connect-line2 --port 5101 --bind 0.0.0.0

With --bind 0.0.0.0 the installer prints a firewall rule suggestion. It does not create the rule; review it and run it yourself. Read Remote access before opening the gateway to the network.

Running service install again with the same values changes nothing. If the service exists with different values (another port, another folder, another executable), the installer refuses with GATEWAY_SERVICE_CONFIG_CONFLICT and leaves it untouched. To change settings, uninstall and install again - your configuration, licence and data stay.

The installed settings (port, bind address, folders) live in the service definition and are fixed at install time. Everything else works as for the tray app.

WhatWhere
Plant configuration (interfaces, signals, bridges, profiles)connect-config.json in the config folder
Licencethe licence folder (by default the config folder)
Models, converted CAD, historythe data folder
Diagnostic log<data folder>\logs\service-<name>.log
Allowed browser originsAllowedOrigins in connect-config.json (recommended) or in appsettings.json
Host settings (ApiKey, log level)appsettings.json next to realvirtual-Connect.exe

Defaults: C:\ProgramData\realvirtual-connect-service\config and C:\ProgramData\realvirtual-connect-service\data.

connect-config.json is written the first time CONNECT saves a setting. On a fresh service without a licence it does not exist yet; you can create it yourself (see Allowed origins and API key).

Without a tray icon, you change the configuration in the viewer (the CONNECT panel of web.realvirtual.io) or in the files:

  1. Stop the service: sc.exe stop realvirtual-connect
  2. Edit connect-config.json in an elevated editor. Only administrators and the service can write to the folder.
  3. Start the service: sc.exe start realvirtual-connect

Do not edit while the service runs; CONNECT rewrites the file on every viewer change and would overwrite your edit. Field names, defaults and which changes need a restart are in the configuration file reference.

Port and bind address come from the installed service and override Urls and Kestrel settings in the configuration. To change them, uninstall and run service install with the new --port or --bind.

There is no tray menu, so the MCP switches are fields in connect-config.json: McpEnabled (needs a restart), McpAllowWrite and McpClientRemoteAllowed (applied immediately). AI control is switched per browser tab in the viewer settings, as before. See AI clients.

There is no tray, so you allow the address of a web page (for example your own web server that hosts the viewer) in the configuration file:

  1. Stop the service: sc.exe stop realvirtual-connect

  2. In connect-config.json in the config folder, set "AllowedOrigins": [ "https://your-server.example" ] (exact scheme://host[:port]). If the file does not exist yet, create it with only this content:

    { "AllowedOrigins": [ "https://your-server.example" ] }

    CONNECT completes the file with its defaults on the next start.

  3. Start the service: sc.exe start realvirtual-connect

Origins in connect-config.json survive an update, because the file lives in the service folder. AllowedOrigins in appsettings.json beside the executable is read as well, but that file is replaced when you unpack a new delivery over the program folder.

ApiKey is set only in appsettings.json. The tray app generates an API key for you; the service does not, so create your own key before you bind to 0.0.0.0, and keep a copy of appsettings.json when you update. See Remote access.

The licence belongs to the service, not to a user. Manage it from an elevated terminal with the license commands; they find the service installed under the default name realvirtual-connect automatically and use its licence folder. The folder is readable only by the service, SYSTEM and administrators, so a terminal without elevation gets a permission error.

Terminal window
realvirtual-Connect.exe license status
realvirtual-Connect.exe license activate <code>
realvirtual-Connect.exe license activate <code> --offline
realvirtual-Connect.exe license import <file>
  • Activate while the service is running. The licence survives service restarts and reboots without a logon.
  • Until a licence is activated, the gateway answers every request with LICENSE_REQUIRED. The free registration is described in Licensing.
  • A licence activated for a tray installation is not shared with the service. Activate it for the service separately.
  • For a service installed with another name or licence folder, add --license-dir <dir> (the licence folder shown by service status); the automatic lookup only knows the default name. Add --port <port> as well when the service does not use port 5100.
TaskCommand
Show state, account, folders, portrealvirtual-Connect.exe service status (no elevation needed)
Startsc.exe start realvirtual-connect or Start-Service realvirtual-connect
Stopsc.exe stop realvirtual-connect or Stop-Service realvirtual-connect

CONNECT has no service start or service stop command; use the Windows tools above (elevated) or the Services console.

service status returns exit code 6 and GATEWAY_SERVICE_NOT_INSTALLED when the service does not exist. A clean stop does not restart the service. If the process crashes, Windows restarts it after 5, 15 and 60 seconds.

The service does not update itself. To update:

  1. Stop the service: sc.exe stop realvirtual-connect
  2. Replace both realvirtual-Connect.exe and realvirtual-connect-cli.exe in the program folder with the files of the new delivery.
  3. Run realvirtual-Connect.exe service install again. With unchanged settings it keeps your configuration, refreshes the converter tools and starts the service.

Configuration (including origins in connect-config.json), licence and data stay in place. If you unpack the whole new delivery into the program folder instead of replacing only the two executables, appsettings.json is replaced too; copy back your ApiKey before you start the service.

Terminal window
realvirtual-Connect.exe service uninstall

This stops and removes the service. The configuration, licence and data folders are kept, so a later install resumes where you left off. To remove everything, delete C:\ProgramData\realvirtual-connect-service afterwards. uninstall refuses to remove a service of the same name that CONNECT did not create.

  • Account. The service runs as NT SERVICE\realvirtual-connect (account LocalService) with a per-service SID and a reduced privilege list. It needs no administrator rights at run time.
  • Program folder. The installer does not change its permissions; it only checks them. Because the service runs these files, it refuses a folder where accounts other than administrators, SYSTEM and TrustedInstaller could write or replace them: GATEWAY_SERVICE_BINARY_DIRECTORY_UNSAFE. The check covers both executables and their folder chain. C:\Program Files passes as it is.
  • Config, licence and data folders. SYSTEM and Administrators have full control; the service has full control on the config and data folders and only read and execute on the service root folder itself; the owner may read the permissions but not change them; everyone else has no access. The installer creates the service folder with these permissions from the start and checks existing folders and their contents before it uses them.
  • Refused locations. UNC and device paths, drives that are not local and fixed, system folders and the tray folder.
  • Secrets in the configuration. Passwords and client secrets of interfaces are stored in plain text in connect-config.json. They are protected by the folder permissions only. Do not copy the file to places with wider access, and enter secrets directly in the CONNECT panel.
  • Log. Secrets are redacted before they are written to the log file.
  • Network. The default bind is 127.0.0.1. Opening it with --bind 0.0.0.0 needs a firewall rule and an ApiKey.

--allow-writable-binary-dir overrides the program folder check for that one installation, and the installer prints a warning. Use it only for a lab machine; the better fix is to move the executables to C:\Program Files.

Start with service status and the log file <data folder>\logs\service-<name>.log; the same folder holds the diagnostic log diag-*.ndjson. CONNECT writes no entries of its own to the Windows Event Log yet; Event Viewer only shows the Service Control Manager’s messages (for example event 7045 when the service is installed, and start or crash events). If the service fails very early, C:\ProgramData\realvirtual-connect-service\data\logs\service-shim-startup.log may hold the reason.

CodeMeaningWhat to do
CLI_ELEVATION_REQUIREDThe terminal is not elevatedOpen PowerShell with Run as administrator
CLI_SHIM_MISSINGrealvirtual-connect-cli.exe is not beside realvirtual-Connect.exeCopy it into the same folder
GATEWAY_SERVICE_SHIM_OUTDATEDThe two executables come from different deliveriesReplace both from the same delivery
GATEWAY_SERVICE_BINARY_DIRECTORY_UNSAFENormal users can write to the program folderMove both files to C:\Program Files\... or another admin-only folder; as a last resort --allow-writable-binary-dir
GATEWAY_SERVICE_CONFIG_CONFLICTA service with this name exists with other settings, another executable or another accountRun service uninstall, then service install with the settings you want. Inspect it with sc.exe qc <name>
GATEWAY_SERVICE_BIND_UNSUPPORTED--bind is not 127.0.0.1 or 0.0.0.0Use one of the two
GATEWAY_SERVICE_DIRECTORY_FORBIDDENA folder is on a network or non-fixed drive, or in a system or tray folderChoose a dedicated folder on a local fixed drive
GATEWAY_SERVICE_DIRECTORY_UNTRUSTEDAn existing folder has unsafe owners, permissions, links or contentsThe message names the path; remove or rename it, or choose another folder. Nothing was changed
GATEWAY_SERVICE_DIRECTORY_CREATE_FAILEDA folder could not be createdCheck the path and the disk, then retry
GATEWAY_SERVICE_TOOLS_IN_USE / GATEWAY_SERVICE_TOOLS_INVALIDThe converter tools could not be unpackedStop programs that use the tools folder and retry; restore the executable from the delivery
GATEWAY_SERVICE_START_FAILEDThe service stopped before it reached RUNNINGRead service-<name>.log; typical causes are a port that is taken or a folder the service cannot write
GATEWAY_SERVICE_START_BUDGET_EXCEEDEDThe service did not reach RUNNING within 120 secondsRead the log, then retry service install
GATEWAY_SERVICE_STOP_TIMEOUTThe service did not stop, so it was not removedWait for shutdown, check service status, retry service uninstall
GATEWAY_SERVICE_NOT_INSTALLEDstatus found no such service (exit code 6)Check --name
CLI_WINDOWS_REQUIREDThe command ran on a non-Windows systemOn Linux use the systemd unit

LICENSE_REQUIRED from the gateway means the service has no licence yet - see Licensing under the service. A port conflict shows up as a failed start; stop whatever uses the port, for example a tray CONNECT.