首页 > 其他 > 详细

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

时间:2018-05-16 13:48:23      阅读:619      评论:0      收藏:0      [点我收藏+]

项目代码如下

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.

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!