OPC UA .NET SDK Configuration

From OPC Labs Knowledge Base
Jump to navigation Jump to search

QuickOPC internally uses .NET Stack and SDK from OPC Foundation for its OPC UA (client-server) operations. The stack and SDK have many configurable parameters, and QuickOPC automatically sets them so that in most cases, you do not have to do any extra steps in this respect. Some of the parameters of the stack and SDK and exposed as configurable parameters in QuickOPC. For advanced purposes, it is possible to manually provide a configuration file for OPC UA .NET Stack and SDK. This feature belongs to Low-Level Configuration, and when it is enabled, the whole set of parameters for OPC UA .NET Stack and SDK becomes accessible to you. The UA configuration file can be placed alongside the application’s executable, and given the same, but a file extension of “.config.xml”. Such file will automatically be found and used, with no extra settings needed. If you want to place the UA configuration file elsewhere or give it a different name, you need to make several other steps yourself then:

  1. Add an entry for a new configuration section, named “UAClientEngine”, into the application configuration file. In Visual Studio, you typically design the contents of the application configuration file is in the app.config file in your project. Note that Visual Studio creates a renamed copy of this file in the build output directory; its actual name in runtime is constructed by taking the full name of the executable (including its extension, such as .exe or .dll), and appending .config to it (so that it becomes something like MyApplication.exe.config, for example). If you do not have this file in your project, add it first. After making this change, the beginning of this file may look like this:

    <?xml version="1.0" encoding="utf-8"?>
         <section name="UAClientEngine" type="Opc.Ua.ApplicationConfigurationSection,Opc.Ua.Core" />
  2. Add a “UAClientEngine” element into the application configuration file. The main purpose of this element is to refer to an external XML file that contains the UA configuration. The element may look like this:

       <ConfigurationLocation xmlns="http://opcfoundation.org/UA/SDK/Configuration.xsd">
  3. Create the UA configuration file with the name specified above, and fill it with settings you need. Unless specified otherwise, the file should be placed alongside the executable of your application.

Please refer to the OPC UA .NET Stack and SDK documentation for information on sections and parameters in the app.config file and in the UA configuration file. Following are examples of what can be changed using the UA configuration file:

  • Transport configurations
  • Transport quotas and timeouts
  • Trace configuration

If you switch your application so that its UA configuration is placed in an external file like described above, you can then also use the “UA Configuration Tool” from OPC Foundation to configure certain parameters for the application (mainly, the security-related settings).