⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 srvinstaller.cs

📁 太阳神短信跟踪服务系统
💻 CS
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Configuration.Install;

namespace apolloService
{
	/// <summary>
	/// SrvInstaller 的摘要说明。
	/// </summary>
	[RunInstaller(true)]
	public class SrvInstaller : System.Configuration.Install.Installer
	{
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

		private System.ServiceProcess.ServiceProcessInstaller spInstaller;
		private System.ServiceProcess.ServiceInstaller sInstaller;


		public SrvInstaller()
		{
			// 该调用是设计器所必需的。
			InitializeComponent();

			// TODO: 在 InitializeComponent 调用后添加任何初始化
		}

		/// <summary> 
		/// 清理所有正在使用的资源。
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}


		#region 组件设计器生成的代码
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			components = new System.ComponentModel.Container();

			// 创建ServiceProcessInstaller对象和ServiceInstaller对象
			this.spInstaller = new System.ServiceProcess.ServiceProcessInstaller();
			this.sInstaller = new System.ServiceProcess.ServiceInstaller();

			// 设定ServiceProcessInstaller对象的帐号、用户名和密码等信息
			this.spInstaller.Account = System.ServiceProcess.ServiceAccount.LocalSystem;
			this.spInstaller.Username = null;
			this.spInstaller.Password = null;
			
			// 设定服务名称
			this.sInstaller.ServiceName = "ApolloMsgSrv";

			// 设定服务的启动方式
			this.sInstaller.StartType = System.ServiceProcess.ServiceStartMode.Automatic;

			this.Installers.AddRange(new System.Configuration.Install.Installer[] {this.spInstaller, this.sInstaller });

		}
		#endregion
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -