.NET Based OPC UA Client/Server SDK  3.1.0.500
Application Instance Base

Overview

The ApplicationInstanceBase manages the application configuration and is associated with one or more Session instances. Each process has a default ApplicationInstanceBase which can be accessed with the ‘Default’ property.

An ApplicationInstanceBase must be started before it can be used by calling the Start method. This executes the activity shown in the following figure:

l3baselibappinstancebaseoverview.png

Configuration

The LoadConfiguration action loads the Application configuration file from a file or a resource. It looks in the following locations for a configuration file:

  1. The value of the ConfigurationFilePath property;
  2. The UaApplicationConfiguration configuration section in the app.config file;
  3. An embedded resource in the entry Assembly with a file name ‘ApplicationSettings.xml’.

If the ConfigurationFilePath is not set, the application looks automatically in configuration section of the app.config file. If the SDK is used as an assembly by another application, the configuration should be set in code or by an external config file.

If no configuration file is found, a default configuration is generated automatically. We highly recommended to use your own configuration.

The schema used by the configuration file is the SecuredApplication schema defined in Part 6 with extensions that are described at Configuration Schema.

The CheckConfiguration action verifies that the configuration is correct and assigns suitable default values to any missing parameters. It will only generate an error if it cannot recover. This activity will generate a new Application Certificate if the AutoCreateCertificate property is set to TRUE.

The CheckConfiguration action will also update the ApplicationUri if it has “localhost” specified as the domain by replacing the “localhost” with the default DNS name of the current computer. This provides an easy way to generate unique ApplicationUris for each machine containing an instance of the application. It will do the same with any BaseAddresses that have “localhost” as their domain.

The StartServer action opens any sockets required to receive requests from Clients. It is only executed if a valid Server object was passed to the method.

The final step in the action invokes the Run callback if one was provided to the Start method. If no callback was provided, the activity completes and the method exits.

Application Developers can create subclasses of the ApplicationInstanceBase object and customize the behavior of any of the activities.