OPC UA .NET SDK Configuration: Difference between revisions

From OPC Labs Knowledge Base
(Created page with "Category:Configuration Category:Low-Level Configuration Category:OPC UA .NET stack Category:UA Configuration Tool <p>QuickOPC internally uses .NET Stack and SD...")
 
No edit summary
Line 10: Line 10:
         design the contents of the application configuration file is in the <b>app.config</b> file in your project. If you do not have this file in your
         design the contents of the application configuration file is in the <b>app.config</b> file in your project. 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:</p>
         project, add it first. After making this change, the beginning of this file may look like this:</p>
 
<syntaxhighlight lang="xml" title="UAClientEngine section declaration in application configuration file">
* UAClientEngine section declaration in application configuration file
<syntaxhighlight lang="xml">
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configuration>
Line 26: Line 24:
         <p>Add a “UAClientEngine” element into the application configuration file. The main purpose of this element is to refer to an external XML file that
         <p>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:</p>
         contains the UA configuration. The element may look like this:</p>
*UAClientEngine section definition in application configuration file
<syntaxhighlight lang="xml" title="UAClientEngine section definition in application configuration file">
 
<syntaxhighlight lang="xml">
<UAClientEngine>
<UAClientEngine>
   <ConfigurationLocation xmlns="http://opcfoundation.org/UA/SDK/Configuration.xsd">
   <ConfigurationLocation xmlns="http://opcfoundation.org/UA/SDK/Configuration.xsd">
Line 43: Line 39:
</ol>
</ol>


<br/>
<p>Please refer to the OPC UA .NET Stack and SDK documentation for information on sections and parameters in the <strong>app.config</strong> file and in the UA
<p>Please refer to the OPC UA .NET Stack and SDK documentation for information on sections and parameters in the <strong>app.config</strong> file and in the UA
configuration file. Following are examples of what can be changed using the UA configuration file:</p>
configuration file. Following are examples of what can be changed using the UA configuration file:</p>
Line 55: Line 52:
</ul>
</ul>


<p>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
<p>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).</p>
Tool]]” from OPC Foundation to configure certain parameters for the application (mainly, the security-related settings).</p>

Revision as of 10:56, 18 January 2021

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. When this 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. 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"?>
    <configuration>
      <configSections>
         <section name="UAClientEngine" type="Opc.Ua.ApplicationConfigurationSection,Opc.Ua.Core" />
       </configSections>
           
    ...
    
  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:

    <UAClientEngine>
       <ConfigurationLocation xmlns="http://opcfoundation.org/UA/SDK/Configuration.xsd">
         <FilePath>MyApplication.Config.xml</FilePath>
       </ConfigurationLocation>
    </UAClientEngine>
    
  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).