如何启动Windows服务的禁用依赖项 [英] how to start the disabled dependency of the windows service

查看:286
本文介绍了如何启动Windows服务的禁用依赖项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开发了Windows服务.该服务中有3种依赖服务,如SQL Express,SQL浏览器,MYSQL.

第一次安装SQL,然后禁用SQL浏览器,没有启动,然后我启动了我的服务,然后抛出异常服务无法启动" .如何在启动我的服务时启动禁用的依赖项服务?

I have developed the windows service . there are 3 dependency service into this service like SQL express ,SQL browser , MYSQL.

first time have installed the SQL then the SQL browser disabled no started then i have started the my service then it throws exception "service could not started" .how to start the disabled dependency service when starting the my service?

推荐答案

ServiceController service = new ServiceController(@"Name of service");
service.Start();
service.WaitForStatus(ServiceControllerStatus.Running, TimeSpan.FromSeconds(1.0));


这篇关于如何启动Windows服务的禁用依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆