C# Class Opc.Ua.Configuration.ApplicationInstance

A class that install, configures and runs a UA application.
ファイルを表示 Open project: OPCFoundation/UA-.NET Class Usage Examples

Public Methods

Method Description
AddToDiscoveryServerTrustList ( X509Certificate2 certificate, string oldThumbprint, IList issuers, CertificateStoreIdentifier trustedCertificateStore ) : void

Adds the application certificate to the discovery server trust list.

ApplicationInstance ( ) : System

Initializes a new instance of the ApplicationInstance class.

ApplicationInstance ( ApplicationConfiguration applicationConfiguration ) : System

Initializes a new instance of the ApplicationInstance class.

CheckApplicationInstanceCertificate ( bool silent, ushort minimumKeySize ) : void

Checks for a valid application instance certificate.

GetHttpUrlForAccessRule ( string baseAddress ) : string

Gets the HTTP URL to use for HTTP access rules.

LoadAppConfig ( bool silent, string filePath, ApplicationType applicationType, Type configurationType, bool applyTraceSettings ) : ApplicationConfiguration

Loads the configuration.

LoadApplicationConfiguration ( bool silent ) : ApplicationConfiguration

Loads the application configuration.

LoadApplicationConfiguration ( string filePath, bool silent ) : ApplicationConfiguration

Loads the application configuration.

LoadInstallConfig ( string configFile ) : void

Loads the installation configuration.

LoadInstallConfigFromFile ( string filePath ) : InstalledApplication

Loads the installation configuration from a file.

LoadInstallConfigFromResource ( string resourcePath, Assembly assembly ) : InstalledApplication

Loads the installation configuration from an embedded resource.

LoadInstallConfigFromStream ( Stream istrm ) : InstalledApplication

Loads the installation configuration from a stream.

ProcessCommandLine ( ) : bool

Processes the command line.

ProcessCommandLine ( bool ignoreUnknownArguments ) : bool

Processes the command line.

SetUaValidationForHttps ( CertificateValidator validator ) : void

Uses the UA validation logic for HTTPS certificates.

Start ( ServerBase server ) : void

Starts the UA server.

StartAsService ( ServerBase server ) : void

Starts the UA server as a Windows Service.

Stop ( ) : void

Stops the UA server.

Protected Methods

Method Description
GetArgumentDescriptions ( ) : ArgumentDescription[]

Gets the descriptions for the supported arguments.

GetHelpString ( ArgumentDescription commands ) : string

Gets the help string.

Install ( bool silent, string>.Dictionary args ) : void

Installs the service.

OnBeforeInstallService ( ) : void

Called immediately before the service is installed.

ProcessCommand ( bool silent, string>.Dictionary args ) : bool

Processes the command.

Uninstall ( bool silent, string>.Dictionary args ) : void

Uninstalls the service.

UpdateAppConfigWithInstallConfig ( ApplicationConfiguration configuration ) : void

Updates the application configuration with the values from the installation configuration.

ValidateArguments ( bool ignoreUnknownArguments, string>.Dictionary args ) : string

Validates the arguments.

Private Methods

Method Description
AddApplicationCertificateToStore ( CertificateStoreIdentifier csid, X509Certificate2 certificate, string oldThumbprint ) : void

Adds an application certificate to a store.

AddIssuerCertificatesToStore ( CertificateStoreIdentifier csid, IList issuers ) : void

Adds an application certificate to a store.

AddToTrustedStore ( ApplicationConfiguration configuration, X509Certificate2 certificate ) : void

Adds the certificate to the Trusted Certificate Store

CertificateValidator_CertificateValidation ( CertificateValidator validator, CertificateValidationEventArgs e ) : void

Handles a certificate validation error.

CheckApplicationInstanceCertificate ( ApplicationConfiguration configuration, X509Certificate2 certificate, bool silent, ushort minimumKeySize ) : bool

Creates an application instance certificate if one does not already exist.

CheckDomainsInCertificate ( ApplicationConfiguration configuration, X509Certificate2 certificate, bool silent ) : bool

Checks that the domains in the server addresses match the domains in the certificates.

ConfigureFileAccess ( ApplicationConfiguration configuration ) : void

Configures access to the executable, the configuration file and the private key.

ConfigureFirewall ( ApplicationConfiguration configuration, bool silent, bool remove ) : void

Configures the firewall.

ConfigureHttpAccess ( ApplicationConfiguration configuration, bool remove ) : void

Configures the HTTP access.

CreateApplicationInstanceCertificate ( ApplicationConfiguration configuration, ushort keySize, ushort lifetimeInMonths ) : X509Certificate2

Creates the application instance certificate.

DeleteApplicationInstanceCertificate ( ApplicationConfiguration configuration ) : void

Deletes an existing application instance certificate.

GetAccessRules ( ) : List

Gets the access rules to use for the application.

HttpsCertificateValidation ( object sender, X509Certificate cert, X509Chain chain, System error ) : bool

Remotes the certificate validate.

SetHttpAccessRules ( string url, bool remove ) : void

Sets the HTTP access rules for the URL.

Method Details

AddToDiscoveryServerTrustList() public static method

Adds the application certificate to the discovery server trust list.
public static AddToDiscoveryServerTrustList ( X509Certificate2 certificate, string oldThumbprint, IList issuers, CertificateStoreIdentifier trustedCertificateStore ) : void
certificate System.Security.Cryptography.X509Certificates.X509Certificate2
oldThumbprint string
issuers IList
trustedCertificateStore CertificateStoreIdentifier
return void

ApplicationInstance() public method

Initializes a new instance of the ApplicationInstance class.
public ApplicationInstance ( ) : System
return System

ApplicationInstance() public method

Initializes a new instance of the ApplicationInstance class.
public ApplicationInstance ( ApplicationConfiguration applicationConfiguration ) : System
applicationConfiguration ApplicationConfiguration The application configuration.
return System

CheckApplicationInstanceCertificate() public method

Checks for a valid application instance certificate.
public CheckApplicationInstanceCertificate ( bool silent, ushort minimumKeySize ) : void
silent bool if set to true no dialogs will be displayed.
minimumKeySize ushort Minimum size of the key.
return void

GetArgumentDescriptions() protected method

Gets the descriptions for the supported arguments.
protected GetArgumentDescriptions ( ) : ArgumentDescription[]
return ArgumentDescription[]

GetHelpString() protected method

Gets the help string.
protected GetHelpString ( ArgumentDescription commands ) : string
commands ArgumentDescription
return string

GetHttpUrlForAccessRule() public static method

Gets the HTTP URL to use for HTTP access rules.
public static GetHttpUrlForAccessRule ( string baseAddress ) : string
baseAddress string
return string

Install() protected method

Installs the service.
protected Install ( bool silent, string>.Dictionary args ) : void
silent bool if set to true no dialogs such be displayed.
args string>.Dictionary Additional arguments provided on the command line.
return void

LoadAppConfig() public static method

Loads the configuration.
public static LoadAppConfig ( bool silent, string filePath, ApplicationType applicationType, Type configurationType, bool applyTraceSettings ) : ApplicationConfiguration
silent bool
filePath string
applicationType ApplicationType
configurationType System.Type
applyTraceSettings bool
return ApplicationConfiguration

LoadApplicationConfiguration() public method

Loads the application configuration.
public LoadApplicationConfiguration ( bool silent ) : ApplicationConfiguration
silent bool
return ApplicationConfiguration

LoadApplicationConfiguration() public method

Loads the application configuration.
public LoadApplicationConfiguration ( string filePath, bool silent ) : ApplicationConfiguration
filePath string
silent bool
return ApplicationConfiguration

LoadInstallConfig() public method

Loads the installation configuration.
public LoadInstallConfig ( string configFile ) : void
configFile string The config file (may be null).
return void

LoadInstallConfigFromFile() public method

Loads the installation configuration from a file.
public LoadInstallConfigFromFile ( string filePath ) : InstalledApplication
filePath string
return InstalledApplication

LoadInstallConfigFromResource() public method

Loads the installation configuration from an embedded resource.
public LoadInstallConfigFromResource ( string resourcePath, Assembly assembly ) : InstalledApplication
resourcePath string
assembly System.Reflection.Assembly
return InstalledApplication

LoadInstallConfigFromStream() public method

Loads the installation configuration from a stream.
public LoadInstallConfigFromStream ( Stream istrm ) : InstalledApplication
istrm Stream
return InstalledApplication

OnBeforeInstallService() protected method

Called immediately before the service is installed.
protected OnBeforeInstallService ( ) : void
return void

ProcessCommand() protected method

Processes the command.
protected ProcessCommand ( bool silent, string>.Dictionary args ) : bool
silent bool if set to true no dialogs such be displayed.
args string>.Dictionary Additional arguments provided on the command line.
return bool

ProcessCommandLine() public method

Processes the command line.
public ProcessCommandLine ( ) : bool
return bool

ProcessCommandLine() public method

Processes the command line.
public ProcessCommandLine ( bool ignoreUnknownArguments ) : bool
ignoreUnknownArguments bool if set to true unknown arguments are ignored.
return bool

SetUaValidationForHttps() public static method

Uses the UA validation logic for HTTPS certificates.
public static SetUaValidationForHttps ( CertificateValidator validator ) : void
validator CertificateValidator The validator.
return void

Start() public method

Starts the UA server.
public Start ( ServerBase server ) : void
server ServerBase The server.
return void

StartAsService() public method

Starts the UA server as a Windows Service.
public StartAsService ( ServerBase server ) : void
server ServerBase The server.
return void

Stop() public method

Stops the UA server.
public Stop ( ) : void
return void

Uninstall() protected method

Uninstalls the service.
protected Uninstall ( bool silent, string>.Dictionary args ) : void
silent bool if set to true no dialogs such be displayed.
args string>.Dictionary Additional arguments provided on the command line.
return void

UpdateAppConfigWithInstallConfig() protected method

Updates the application configuration with the values from the installation configuration.
protected UpdateAppConfigWithInstallConfig ( ApplicationConfiguration configuration ) : void
configuration ApplicationConfiguration The configuration to update.
return void

ValidateArguments() protected method

Validates the arguments.
protected ValidateArguments ( bool ignoreUnknownArguments, string>.Dictionary args ) : string
ignoreUnknownArguments bool
args string>.Dictionary
return string