Using a Windows Service to Startup
You can configure a Windows server to automatically start a project when the computer starts using a Windows Service. The Windows Service starts the application as soon as the computer is powered on and the Windows Operating System starts, even if no user has logged in to Windows.
This procedure is automatically executed by the system when selected for startup mode, as describe on
Setup the server to start the runtime. This section will explain how to setup it manually.
Use the Windows Service only on production servers that you are not using as engineering stations, and only if you need the ability to differentiate Windows users logging in while the project is running.
The first several steps of the procedure below are required to let you set up the Windows Service.
To run your application as a Windows Service:
1. Go to Info > Project > Redundancy.
2. Enter or select the information, as needed.
Field | Description |
Enable Configuration | Select to enable the configuration. |
Primary Server IP and Target Port | Enter the IP address and port of the primary server. |
Secondary Server IP and Target Port | Enter the IP address and port of the secondary server, if any. |
On Primary Startup | Select the option you want. |
Historian Replication | Select how to handle historian replication. |
Connection Timeout | Connection timeout time, in seconds, to switch to secondary server. |
Server Command Line | Read-only field populated based on the fields above. Click Copy to Clipboard to copy the command for use. |
Rich Client command | The commands to start a Rich Client with the project selected parameters |
Smart Client url | The URL to access the Smart Client with the project’s parameters |
Web Client url | The URL to access the Web Client with the project’s parameters |
View-Only | If checked, apply View-Only parameter to Rich and Smart Client’s url |
Windows Authentication | If checked, apply Windows Authentication logon parameter to Rich and Smart Client’s url |
3. Next to the Server Command Line field, click Copy to Clipboard.
•This copies the read-only field that was populated based on the fields above it.
4. Open a text file, paste, and continue with steps
5 through
7 in the file.
5. If you are not using redundancy, delete the redundancy part of the text.
6. At the beginning of the command line, enter or paste the full path to the FactoryStudio installation folder and put quotes around it.
•It should look something like this:
“C:\Program Files (x86)\Tatsoft\FactoryStudio\fs-2014.1.3\tStartup.exe”
7. Before the “tproj” text, enter or paste the full path to the project.
•It should look something like this:
/project:C:\FactoryStudio Projects\<project_name>.tproj
•The whole command line should look something like this:
“C:\Program Files (x86)\Tatsoft\FactoryStudio\fs-2014.1.3\tStartup.exe” /project:C:\Factory Studio Projects\<project_name>.tproj /username:<username>
8. Leave the text file open for use in step
10.
9. From the DOS prompt, go to the <.NET Framework Install Path> and execute the following command:
installutil <InstallPath>\<fs-version>\TStartupAsService.exe
•Example:
C:\Windows\Microsoft.NET\Framework\v2.0.50727>installutil c:\Program files\Tatsoft\FactoryStudio\fs-2014.1\TStartupAsService.exe
10. Copy and paste the command you created in the text file.
11. In the Windows Registry, set up the parameters on:
"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\TStartup\ImagePath"
•Example:
"c:\\tatsoft\fs-2014.1\TStartupAsService.exe" "/project:C:\FactoryStudio Projects\Project1.tproj"
12. In the Windows Services (Administrative Tools), set "TStartup Service" to Automatic, so the selected project will start when the computer starts.