文章内容

2017/11/7 15:29:38,作 者: 黄兵

windows service 描述

最近写了一个windows servic,之后已经调试的可以部署了,但是在任务窗口没有描述,如下图所示:


描述哪里什么都没有,怎么加呢?在安装配置文件写如下代码:

using System.ServiceProcess;
using System.Configuration.Install;
using System.ComponentModel;

namespace AppService
{
    [RunInstaller(true)]
    public class CronInstaller : Installer
    {
        private ServiceProcessInstaller processInstaller;
        private ServiceInstaller serviceInstaller;

        public CronInstaller()
        {
            processInstaller = new ServiceProcessInstaller();
            serviceInstaller = new ServiceInstaller();

            processInstaller.Account = ServiceAccount.LocalSystem;
            serviceInstaller.StartType = ServiceStartMode.Manual;
            //must match CronService.ServiceName
            serviceInstaller.ServiceName = "Cron";

            serviceInstaller.DisplayName = "WebSite Service";
            serviceInstaller.Description = "为网站提供定时从知乎API获取内容,增加文章的时候从队列建立索引。如果此服务被禁用,则明确依赖该服务的任何服务都无法启动。";

            Installers.Add(serviceInstaller);
            Installers.Add(processInstaller);
        }
    }
}
ServiceInstaller. Description 就是windows servic的描述。
参考资料:

黄兵个人博客原创。

转载请注明出处:黄兵个人博客 - windows service 描述

分享到:

发表评论

评论列表