码迷,mamicode.com
首页 > 其他好文 > 详细

System.ServiceProcess.TimeoutException: Time out has expired and the operation has not been completed.

时间:2018-05-16 15:37:00      阅读:281      评论:0      收藏:0      [点我收藏+]

标签:overflow   and   perl   tac   ODB   div   设置   mes   sage   

项目代码如下

ServiceController service = new ServiceController("ModbusAgent");
service.Stop();
TimeSpan timeout = new TimeSpan(50000);
service.WaitForStatus(ServiceControllerStatus.Stopped, timeout); 

按照Stackoverflow:Time out has expired and the operation has not been completed in Service manager的说法,不要对其设置服务超时

 于是代码改成:

ServiceController service = new ServiceController("ModbusAgent");
service.Stop();
service.WaitForStatus(ServiceControllerStatus.Stopped); 

问题解决

System.ServiceProcess.TimeoutException: Time out has expired and the operation has not been completed.

标签:overflow   and   perl   tac   ODB   div   设置   mes   sage   

原文地址:https://www.cnblogs.com/passedbylove/p/9045595.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!