using System; using System.Diagnostics; using System.ServiceProcess; using System.ComponentModel; namespace Ease.SvcHost { [ToolboxItem(false)] public class HostService : ServiceBase { /// /// Required designer variable. /// private RemotingHost _host; private System.ComponentModel.Container components = null; public HostService(string name) { // This call is required by the Windows.Forms Component Designer. InitializeComponent(); base.ServiceName = name; } #region Component Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { // // RemotingHostService // this.ServiceName = "ServiceHost"; } #endregion /// /// Clean up any resources being used. /// protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } /// /// Set things in motion so your service can do its work. /// protected override void OnStart(string[] args) { _host = new RemotingHost(); _host.Start(); EventLog.WriteEntry(_host.Status); } /// /// Stop this service. /// protected override void OnStop() { _host.Stop(); EventLog.WriteEntry(_host.Status); } } }