.NET Based OPC UA Client/Server SDK
3.3.0.530
|
The ApplicationInstance inherits from the Application Instance Base and expands the application with configuration trouth the command line and run as service functionality.
Please read the Application Instance Base paragraph first.
An ApplicationInstance must be started before it can be used by calling the Start method. This executes the activity shown in the following figure:
The LoadConfiguration action in Application Instance loads the Application configuration file from a file or a resource. This happens in a slightly different way then in the Application Instance Base. If the configuration is set in memory, the LoadConfiguration will be skipped at ApplicationInstance.Start(). It looks in the following locations for a configuration file:
/configFile
command line parameter;app.config
file;ApplicationSettings.xml
;If no ConfigurationFilePath
is set via the command line or the ConfigurationFilePath
property, the application automatically searches the configuration section of the app.config
file. If the SDK is used as an assembly by another application, add the UaApplicationConfiguration section to the exiting app.config file or use one of the other options to set your configuration.
The ProcessCommandLine
action does any special processing based on the command line arguments. If no further processing is required, then the Start method exits.
The ParseCommandLine
action validates the command line arguments. The command line syntax requires command keywords proceeded by a forward slash and followed by an optional parameter separated by a colon. For example:
/silent /configFile:"C:\My Config.xml"
Double quotes must be used to enclose parameters with whitespaces.
The ApplicationInstance class supports the following command line parameters:
Parameter | Description |
---|---|
/service | Starts the application as a service (/service [/silent] [/configFile:<filepath>] ).It is necessary to set the parameter InstallAsService and InstallationSettings ServiceName in the config file and install the application using /install (see below) first. |
/install | Installs the application (/install [/silent] [/configFile:<filepath>] ). |
/uninstall | Uninstalls the application (/uninstall [/silent] [/configFile:<filepath>] ). |
/silent | Performs operations without prompting user to confirm or displaying errors. |
/configFile | The configuration file to use with the application. |
Application developers can add support for additional arguments by creating a subclass of ApplicationInstance.
The RunAsService action starts the application as a Windows Service. This action will run if the application is launched by a non-interactive user. It passes control to the Service Control Manager (SCM) which will then complete the activity from a different thread. The Start method exits normally.
Application developers can create subclasses of the ApplicationInstance object and customize the behavior of any of the activities.