Opc.Ua.Configuration.ApplicationInstance.StartAsService C# (CSharp) Method

StartAsService() public method

Starts the UA server as a Windows Service.
public StartAsService ( ServerBase server ) : void
server ServerBase The server.
return void
        public void StartAsService(ServerBase server)
        {
            m_server = server;
            ServiceBase.Run(new WindowsService(server, ConfigSectionName, ApplicationType, ConfigurationType));
        }

Usage Example

コード例 #1
0
ファイル: Program.cs プロジェクト: OPCFoundation/UA-.NET
        static void Main()
        {
            ReportGenerator g = new ReportGenerator();
            g.Initialize();
            g.GenerateFluidLevelTestReport();
            g.GenerateFluidLevelTestReport();
            g.GenerateFluidLevelTestReport();

            // Initialize the user interface.
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            ApplicationInstance application = new ApplicationInstance();
            application.ApplicationType   = ApplicationType.Server;
            application.ConfigSectionName = "HistoricalEventsServer";

            try
            {
                // process and command line arguments.
                if (application.ProcessCommandLine())
                {
                    return;
                }

                // check if running as a service.
                if (!Environment.UserInteractive)
                {
                    application.StartAsService(new HistoricalEventsServer());
                    return;
                }

                // load the application configuration.
                application.LoadApplicationConfiguration(false);

                // check the application certificate.
                application.CheckApplicationInstanceCertificate(false, 0);

                // start the server.
                application.Start(new HistoricalEventsServer());

                // run the application interactively.
                Application.Run(new ServerForm(application));
            }
            catch (Exception e)
            {
                ExceptionDlg.Show(application.ApplicationName, e);
                return;
            }
        }
All Usage Examples Of Opc.Ua.Configuration.ApplicationInstance::StartAsService