FREE Subscription to Dr. Dobb’s Digest: Same Great Content, New Digital Edition
Site Archive (Complete)
Dobbs M-Dev
Email
Print
Reprint

add to:
Del.icio.us
Digg
Google
Furl
Slashdot
Y! MyWeb
Blink
May 01, 2002

Create Windows Services in the .Net Framework

(Page 8 of 8)
Create Windows Services in the .Net Framework

Example 2:
The ProjectInstaller.cs class

using System;
using System.Collections;
using System.ComponentModel;
using System.Configuration.Install;

namespace SqlMonitorService
{
    /// <summary>
    /// Summary description for ProjectInstaller.
    /// </summary>
    [RunInstaller(true)]
    public class ProjectInstaller :
 System.Configuration.Install.Installer
    {
        private System.ServiceProcess.ServiceProcessInstaller 
SqlMonitorServiceProcessInstaller;
        private System.ServiceProcess.ServiceInstaller 
SqlMonitorServiceInstaller;
        /// <summary>
        /// Required designer variable.
        /// </summary>
//      private System.ComponentModel.Container 
//          components = null;

        public ProjectInstaller()
        {
            // This call is required by the Designer.
            InitializeComponent();

        }

        #region Component Designer generated code
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.SqlMonitorServiceProcessInstaller = 
            new 
            System.ServiceProcess.ServiceProcessInstaller(
            );
            this.SqlMonitorServiceInstaller = 
            new System.ServiceProcess.ServiceInstaller();
            // 
            // SqlMonitorServiceProcessInstaller
            // 
            this.SqlMonitorServiceProcessInstaller.Account = 
            System.ServiceProcess.ServiceAccount.LocalSystem;
            
            this.SqlMonitorServiceProcessInstaller.Password = null;
            this.SqlMonitorServiceProcessInstaller.Username = null;

            // 
            // SqlMonitorServiceInstaller
            // 
            this.SqlMonitorServiceInstaller.ServiceName = 
            "SQLMonitorService";
            this.SqlMonitorServiceInstaller.StartType = 
            System.ServiceProcess.ServiceStartMode.Automatic;
            // 
            // ProjectInstaller
            // 
            this.Installers.AddRange(
            new System.Configuration.Install.Installer[] {
        this.SqlMonitorServiceProcessInstaller,
            this.SqlMonitorServiceInstaller});

        }
        #endregion
    }
}
Previous Page | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8
RELATED ARTICLES
No Related Articles
TOP 5 ARTICLES
No Top Articles.



MICROSITES
FEATURED TOPIC

ADDITIONAL TOPICS

INFO-LINK