# OpcApplicationConfiguration Members

> Reference: Represents the configuration of an OPC UA application, which completes missing settings using the defaults of the SDK.

<dl class="api-definition">
<dt>Type</dt>
<dd><a href="./">OpcApplicationConfiguration</a></dd>
<dt>Namespace</dt>
<dd><a href="../namespaces/opc.uafx">Opc.UaFx</a></dd>
<dt>Assembly</dt>
<dd>Opc.UaFx.Advanced.dll</dd>
<dt>Package</dt>
<dd>Opc.UaFx.Advanced v2.59.0</dd>
<dt>Also in</dt>
<dd>Opc.UaFx.Client</dd>
</dl>

## Constructors

### OpcApplicationConfiguration

<span class="api-meta">2 overloads</span>

| Overload | Description |
|---|---|
| [OpcApplicationConfiguration()](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcapplicationconfiguration/members#opcapplicationconfiguration-noparams) | Initializes a new instance of the [OpcApplicationConfiguration](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcapplicationconfiguration/) class using the defaults of the SDK. |
| [OpcApplicationConfiguration(OpcApplicationType)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcapplicationconfiguration/members#opcapplicationconfiguration-opc-uafx-opcapplicationtype)<span class="api-meta">since v2.7</span> | Initializes a new instance of the [OpcApplicationConfiguration](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcapplicationconfiguration/) class for an application of the type specified using the defaults of the SDK. |

#### OpcApplicationConfiguration()

Initializes a new instance of the [OpcApplicationConfiguration](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcapplicationconfiguration/) class using the defaults of the SDK.

<div class="api-signature" data-lang="csharp">

```csharp
public OpcApplicationConfiguration()
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public Sub New()
```

</div>

**Remarks**

The application name is the title or the product of the entry assembly, otherwise "OPC Application". The product URI is built from the company and the product of the entry assembly ("urn:company:product" if one of them is missing). Untrusted certificates are accepted automatically (see <abbr title="OPC Foundation stack type, not documented here: Opc.Ua.SecurityConfiguration.AutoAcceptUntrustedCertificates">AutoAcceptUntrustedCertificates</abbr>).

#### OpcApplicationConfiguration(OpcApplicationType)

<span class="api-meta">since v2.7</span>

Initializes a new instance of the [OpcApplicationConfiguration](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcapplicationconfiguration/) class for an application of the type specified using the defaults of the SDK.

<div class="api-signature" data-lang="csharp">

```csharp
public OpcApplicationConfiguration(OpcApplicationType applicationType)
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public Sub New(applicationType As OpcApplicationType)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `applicationType` | [OpcApplicationType](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcapplicationtype/) | The type of the application. |

**Remarks**

See [OpcApplicationConfiguration](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcapplicationconfiguration/members#opcapplicationconfiguration-noparams). The settings the type requires (e.g. the client configuration of a client) are created as well.

## Methods

### LoadClientConfig

<span class="api-meta">static</span>

Loads the configuration of a client from the configuration file named after the `configSectionName` specified.

<div class="api-signature" data-lang="csharp">

```csharp
public static OpcApplicationConfiguration LoadClientConfig(
    string configSectionName)
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public Shared Function LoadClientConfig(
    configSectionName As String) As OpcApplicationConfiguration
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `configSectionName` | [String](https://learn.microsoft.com/dotnet/api/system.string) | The name of the configuration, which is the path of the file without the extension ".Config.xml". |

**Returns**

[OpcApplicationConfiguration](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcapplicationconfiguration/)

The configuration loaded, or a null reference (Nothing in Visual Basic) if the file could not be loaded.

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentException](https://learn.microsoft.com/dotnet/api/system.argumentexception) | The `configSectionName` is equals [Empty](https://learn.microsoft.com/dotnet/api/system.string.empty). |
| [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception) | The `configSectionName` is a null reference (Nothing in Visual Basic). |

**Remarks**

See [LoadFromConfig](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcapplicationconfiguration/members#loadfromconfig).

### LoadClientConfigFile

<span class="api-meta">static</span>

Loads the configuration of a client from the file specified.

<div class="api-signature" data-lang="csharp">

```csharp
public static OpcApplicationConfiguration LoadClientConfigFile(string filePath)
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public Shared Function LoadClientConfigFile(
    filePath As String) As OpcApplicationConfiguration
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `filePath` | [String](https://learn.microsoft.com/dotnet/api/system.string) | The path of the configuration file. |

**Returns**

[OpcApplicationConfiguration](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcapplicationconfiguration/)

The configuration loaded, or a null reference (Nothing in Visual Basic) if the file could not be loaded.

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentException](https://learn.microsoft.com/dotnet/api/system.argumentexception) | The `filePath` is equals [Empty](https://learn.microsoft.com/dotnet/api/system.string.empty). |
| [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception) | The `filePath` is a null reference (Nothing in Visual Basic). |

**Remarks**

See [LoadFromConfigFile](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcapplicationconfiguration/members#loadfromconfigfile).

### LoadClientServerConfig

<span class="api-meta">static</span>

Loads the configuration of an application which is a client and a server from the configuration file named after the `configSectionName` specified.

<div class="api-signature" data-lang="csharp">

```csharp
public static OpcApplicationConfiguration LoadClientServerConfig(
    string configSectionName)
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public Shared Function LoadClientServerConfig(
    configSectionName As String) As OpcApplicationConfiguration
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `configSectionName` | [String](https://learn.microsoft.com/dotnet/api/system.string) | The name of the configuration, which is the path of the file without the extension ".Config.xml". |

**Returns**

[OpcApplicationConfiguration](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcapplicationconfiguration/)

The configuration loaded, or a null reference (Nothing in Visual Basic) if the file could not be loaded.

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentException](https://learn.microsoft.com/dotnet/api/system.argumentexception) | The `configSectionName` is equals [Empty](https://learn.microsoft.com/dotnet/api/system.string.empty). |
| [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception) | The `configSectionName` is a null reference (Nothing in Visual Basic). |

**Remarks**

See [LoadFromConfig](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcapplicationconfiguration/members#loadfromconfig).

### LoadClientServerConfigFile

<span class="api-meta">static</span>

Loads the configuration of an application which is a client and a server from the file specified.

<div class="api-signature" data-lang="csharp">

```csharp
public static OpcApplicationConfiguration LoadClientServerConfigFile(
    string filePath)
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public Shared Function LoadClientServerConfigFile(
    filePath As String) As OpcApplicationConfiguration
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `filePath` | [String](https://learn.microsoft.com/dotnet/api/system.string) | The path of the configuration file. |

**Returns**

[OpcApplicationConfiguration](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcapplicationconfiguration/)

The configuration loaded, or a null reference (Nothing in Visual Basic) if the file could not be loaded.

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentException](https://learn.microsoft.com/dotnet/api/system.argumentexception) | The `filePath` is equals [Empty](https://learn.microsoft.com/dotnet/api/system.string.empty). |
| [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception) | The `filePath` is a null reference (Nothing in Visual Basic). |

**Remarks**

See [LoadFromConfigFile](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcapplicationconfiguration/members#loadfromconfigfile).

### LoadDiscoveryServerConfig

<span class="api-meta">static</span>

Loads the configuration of a discovery server from the configuration file named after the `configSectionName` specified.

<div class="api-signature" data-lang="csharp">

```csharp
public static OpcApplicationConfiguration LoadDiscoveryServerConfig(
    string configSectionName)
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public Shared Function LoadDiscoveryServerConfig(
    configSectionName As String) As OpcApplicationConfiguration
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `configSectionName` | [String](https://learn.microsoft.com/dotnet/api/system.string) | The name of the configuration, which is the path of the file without the extension ".Config.xml". |

**Returns**

[OpcApplicationConfiguration](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcapplicationconfiguration/)

The configuration loaded, or a null reference (Nothing in Visual Basic) if the file could not be loaded.

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentException](https://learn.microsoft.com/dotnet/api/system.argumentexception) | The `configSectionName` is equals [Empty](https://learn.microsoft.com/dotnet/api/system.string.empty). |
| [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception) | The `configSectionName` is a null reference (Nothing in Visual Basic). |

**Remarks**

See [LoadFromConfig](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcapplicationconfiguration/members#loadfromconfig).

### LoadDiscoveryServerConfigFile

<span class="api-meta">static</span>

Loads the configuration of a discovery server from the file specified.

<div class="api-signature" data-lang="csharp">

```csharp
public static OpcApplicationConfiguration LoadDiscoveryServerConfigFile(
    string filePath)
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public Shared Function LoadDiscoveryServerConfigFile(
    filePath As String) As OpcApplicationConfiguration
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `filePath` | [String](https://learn.microsoft.com/dotnet/api/system.string) | The path of the configuration file. |

**Returns**

[OpcApplicationConfiguration](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcapplicationconfiguration/)

The configuration loaded, or a null reference (Nothing in Visual Basic) if the file could not be loaded.

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentException](https://learn.microsoft.com/dotnet/api/system.argumentexception) | The `filePath` is equals [Empty](https://learn.microsoft.com/dotnet/api/system.string.empty). |
| [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception) | The `filePath` is a null reference (Nothing in Visual Basic). |

**Remarks**

See [LoadFromConfigFile](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcapplicationconfiguration/members#loadfromconfigfile).

### LoadFromConfig

<span class="api-meta">static</span>

Loads an application configuration from the configuration file named after the `configSectionName` specified.

<div class="api-signature" data-lang="csharp">

```csharp
public static OpcApplicationConfiguration LoadFromConfig(
    ApplicationType applicationType,
    string configSectionName)
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public Shared Function LoadFromConfig(
    applicationType As ApplicationType,
    configSectionName As String) As OpcApplicationConfiguration
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `applicationType` | <abbr title="OPC Foundation stack type, not documented here: Opc.Ua.ApplicationType">ApplicationType</abbr> | The type of the application the configuration is validated for. |
| `configSectionName` | [String](https://learn.microsoft.com/dotnet/api/system.string) | The name of the configuration, which is the path of the file without the extension ".Config.xml". |

**Returns**

[OpcApplicationConfiguration](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcapplicationconfiguration/)

The configuration loaded, or a null reference (Nothing in Visual Basic) if the file could not be loaded.

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentException](https://learn.microsoft.com/dotnet/api/system.argumentexception) | The `configSectionName` is equals [Empty](https://learn.microsoft.com/dotnet/api/system.string.empty). |
| [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception) | The `configSectionName` is a null reference (Nothing in Visual Basic). |

**Remarks**

A relative path is resolved against the current directory. An error while loading or validating the file (e.g. a missing file) is written to the trace and results in a null reference. Settings missing in the file are completed using the defaults of the SDK.

### LoadFromConfigFile

<span class="api-meta">static</span>

Loads an application configuration from the file specified.

<div class="api-signature" data-lang="csharp">

```csharp
public static OpcApplicationConfiguration LoadFromConfigFile(
    ApplicationType applicationType,
    string filePath)
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public Shared Function LoadFromConfigFile(
    applicationType As ApplicationType,
    filePath As String) As OpcApplicationConfiguration
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `applicationType` | <abbr title="OPC Foundation stack type, not documented here: Opc.Ua.ApplicationType">ApplicationType</abbr> | The type of the application the configuration is validated for. |
| `filePath` | [String](https://learn.microsoft.com/dotnet/api/system.string) | The path of the configuration file. |

**Returns**

[OpcApplicationConfiguration](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcapplicationconfiguration/)

The configuration loaded, or a null reference (Nothing in Visual Basic) if the file could not be loaded.

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentException](https://learn.microsoft.com/dotnet/api/system.argumentexception) | The `filePath` is equals [Empty](https://learn.microsoft.com/dotnet/api/system.string.empty). |
| [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception) | The `filePath` is a null reference (Nothing in Visual Basic). |

**Remarks**

An error while loading or validating the file (e.g. a missing file) is written to the trace and results in a null reference. Settings missing in the file are completed using the defaults of the SDK (e.g. the certificate stores); the defaults set by the constructors (e.g. accepting untrusted certificates automatically) are not applied.

### LoadServerConfig

<span class="api-meta">static</span>

Loads the configuration of a server from the configuration file named after the `configSectionName` specified.

<div class="api-signature" data-lang="csharp">

```csharp
public static OpcApplicationConfiguration LoadServerConfig(
    string configSectionName)
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public Shared Function LoadServerConfig(
    configSectionName As String) As OpcApplicationConfiguration
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `configSectionName` | [String](https://learn.microsoft.com/dotnet/api/system.string) | The name of the configuration, which is the path of the file without the extension ".Config.xml". |

**Returns**

[OpcApplicationConfiguration](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcapplicationconfiguration/)

The configuration loaded, or a null reference (Nothing in Visual Basic) if the file could not be loaded.

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentException](https://learn.microsoft.com/dotnet/api/system.argumentexception) | The `configSectionName` is equals [Empty](https://learn.microsoft.com/dotnet/api/system.string.empty). |
| [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception) | The `configSectionName` is a null reference (Nothing in Visual Basic). |

**Remarks**

See [LoadFromConfig](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcapplicationconfiguration/members#loadfromconfig).

### LoadServerConfigFile

<span class="api-meta">static</span>

Loads the configuration of a server from the file specified.

<div class="api-signature" data-lang="csharp">

```csharp
public static OpcApplicationConfiguration LoadServerConfigFile(string filePath)
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public Shared Function LoadServerConfigFile(
    filePath As String) As OpcApplicationConfiguration
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `filePath` | [String](https://learn.microsoft.com/dotnet/api/system.string) | The path of the configuration file. |

**Returns**

[OpcApplicationConfiguration](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcapplicationconfiguration/)

The configuration loaded, or a null reference (Nothing in Visual Basic) if the file could not be loaded.

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentException](https://learn.microsoft.com/dotnet/api/system.argumentexception) | The `filePath` is equals [Empty](https://learn.microsoft.com/dotnet/api/system.string.empty). |
| [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception) | The `filePath` is a null reference (Nothing in Visual Basic). |

**Remarks**

See [LoadFromConfigFile](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcapplicationconfiguration/members#loadfromconfigfile).

### Validate

<span class="api-meta">2 overloads</span>

| Overload | Description |
|---|---|
| [Validate()](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcapplicationconfiguration/members#validate-noparams) | Ensures that the application configuration is valid. |
| [Validate(OpcContext)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcapplicationconfiguration/members#validate-opc-uafx-opccontext)<span class="api-meta">since v2.11</span> | Ensures that the application configuration is valid. |

**Exceptions (all overloads)**

| Exception | Condition |
|---|---|
| [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/) | The configuration is invalid. |

#### Validate()

Ensures that the application configuration is valid.

<div class="api-signature" data-lang="csharp">

```csharp
public void Validate()
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public Sub Validate()
```

</div>

#### Validate(OpcContext)

<span class="api-meta">since v2.11</span>

Ensures that the application configuration is valid.

<div class="api-signature" data-lang="csharp">

```csharp
public void Validate(OpcContext context)
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public Sub Validate(context As OpcContext)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `context` | [OpcContext](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccontext/) |  |
