.NET Based OPC UA Client/Server SDK  3.3.3.537
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 UnifiedAutomation.UaBase.ApplicationInstanceBase.Start Start method. This executes the activity shown in the following figure:

l3baselibappinstancebaseoverview.png

Configuration

The LoadConfiguration action loads the Application configuration from a file or a resource. If the configuration is set in memory, the LoadConfiguration will be skipped at ApplicationInstanceBase.Start(). A configuration file is searched for in the following places. The first hit in this order is taken.

  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.
    Remark: This file should contain only the SecuredApplication XML tag, as opposed to app.config.
  4. Use of default configuration

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, add the UaApplicationConfiguration section to the exiting app.config file or use one of the other options to set your configuration.

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 OPC UA specification 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.