C# Class Opc.Ua.Configuration.ApplicationInstance

A class that install, configures and runs a UA application.
Afficher le fichier Open project: OPCFoundation/UA-.NET Class Usage Examples

Méthodes publiques

Méthode 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.

Méthodes protégées

Méthode 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

Méthode 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 méthode

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
Résultat void

ApplicationInstance() public méthode

Initializes a new instance of the ApplicationInstance class.
public ApplicationInstance ( ) : System
Résultat System

ApplicationInstance() public méthode

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

CheckApplicationInstanceCertificate() public méthode

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.
Résultat void

GetArgumentDescriptions() protected méthode

Gets the descriptions for the supported arguments.
protected GetArgumentDescriptions ( ) : ArgumentDescription[]
Résultat ArgumentDescription[]

GetHelpString() protected méthode

Gets the help string.
protected GetHelpString ( ArgumentDescription commands ) : string
commands ArgumentDescription
Résultat string

GetHttpUrlForAccessRule() public static méthode

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

Install() protected méthode

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.
Résultat void

LoadAppConfig() public static méthode

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
Résultat ApplicationConfiguration

LoadApplicationConfiguration() public méthode

Loads the application configuration.
public LoadApplicationConfiguration ( bool silent ) : ApplicationConfiguration
silent bool
Résultat ApplicationConfiguration

LoadApplicationConfiguration() public méthode

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

LoadInstallConfig() public méthode

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

LoadInstallConfigFromFile() public méthode

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

LoadInstallConfigFromResource() public méthode

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

LoadInstallConfigFromStream() public méthode

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

OnBeforeInstallService() protected méthode

Called immediately before the service is installed.
protected OnBeforeInstallService ( ) : void
Résultat void

ProcessCommand() protected méthode

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.
Résultat bool

ProcessCommandLine() public méthode

Processes the command line.
public ProcessCommandLine ( ) : bool
Résultat bool

ProcessCommandLine() public méthode

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

SetUaValidationForHttps() public static méthode

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

Start() public méthode

Starts the UA server.
public Start ( ServerBase server ) : void
server ServerBase The server.
Résultat void

StartAsService() public méthode

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

Stop() public méthode

Stops the UA server.
public Stop ( ) : void
Résultat void

Uninstall() protected méthode

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.
Résultat void

UpdateAppConfigWithInstallConfig() protected méthode

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

ValidateArguments() protected méthode

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