Making your application into a Windows Service
To turn your server application into a Windows Service, first ensure that your image holds the AbtNtServiceSupportApp, AbtNtServicePackagingApp, and the application you want to deploy as a Windows Service. With the feature and your application loaded, complete the following steps:
1. Open a browser on your application and implement two methods.
The first method, which goes in your application class, provides an entry point into the application. This method should complete the startup of your service application by immediately sending the following message:
AbtNtServiceInterface default registerService: aClassName stopSelector: aSelector
aClassName is the class that implements aSelector. This selector's method will be invoked when the Windows Service Control Manager sends a SERVICE_STOP message to the service. A sample VA Smalltalk service application is provided with the Server Workbench feature, AbtNtServiceExampleApp, sends the following method:
AbtNtServiceInterface default registerService: self name stopSelector: #stopping.
Registering the stop selector also tells the SCM that the service has started. Failure to send the message immediately may result in an error in starting the service as the SCM might time out waiting for notification that the service has started.
The second method, a class method aSelector in the class aClassName, should stop your application's processing in an orderly manner. When this method returns, VA Smalltalk will exit with a return code of 0.
2. Ensure that your application names AbtNtServiceSupportApp as a prerequisite. Also ensure that your application does not name AbtViewApplication as a prerequisite. Because your service application must be headless, you do not need AbtViewApplication, which supports visual parts.
3. Package your application using the packager. You must assign your packaged image the same name you'll be using for the Windows Service. See Packaging your Visual Application.
4. Test your application to make sure it runs as desired.
 
tips
If you do not have an application that would be appropriate for a service, load the application AbtNtServiceExampleApp, then complete these steps.
a. From the System Transcript menu bar, select the Tools >Browse Packaged Images entry to open the Packager Control Panel.
b. Click on the Instructions in Database tab and then double click the AbtNtServicePackagingApp entry to expose the AbtNtServiceImagePackagingInstructions selection.
c. Select AbtNtServiceImagePackagingInstructions and proceed to Modify Instructions.
d. Under Available Applications, select AbtNtServiceExampleApp and move it to Selected Applications and ICs.
e. Click the Startup Code tab. Set the Image Startup Class to AbtNtServiceHeadlessRuntimeStartUp.
Set Application Entry Point to AbtNtServiceExampleApp starting and Output File to ntservex.icx
Troubleshooting
The Locale setting influence how dates, times, monetary values etc. are displayed. For instance, if the language and territory are german-germany, dates will be printed as month day year. So Sept 23, 2020 is displayed 23.9.2020 in german rather than 9/23/2020 as it is in english.
If the Locale settings are not being properly picked up when you run your VAST Platform application as a Windows Service, but they are when you run it from a console, then it could be an issue of what user is logged in when the VAST application launches:
When you launch a VAST application from a normal CMD console, it uses the normal Windows user logged in (.e.g. John Doe user) to determine the Locale setting.
But when you register the VAST application as a service, the user will probably be "Local System" (the default). You can confirm the user by looking at your registered VAST service and the column "Log On As".
The problem is that the "Local System" settings for Locale etc. are not necessarily the same as your current Windows user (.e.g. "John Doe"). The solution is to specify the Locale information also to the "Local System" user. Here is an example of how to do it: "Apply regional settings to the Local System account on Windows 10’
 
Last modified date: 10/07/2020