System.ServiceProcess.TimeoutException: Time out has expired and the operation has not been completed.
项目代码如下
ServiceController service = new ServiceController("ModbusAgent");
service.Stop();
TimeSpan timeout = new TimeSpan();
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.的更多相关文章
- System.ServiceProcess与System.Configuration.Install命名空间的介绍
System.ServiceProcess 命名空间提供用于实现.安装和控制 Windows 服务应用程序的类.服务是长期运行的可执行文件,其运行没有用户界面 System.ServiceProces ...
- .net core linux环境下 System.Data.SqlClient.SqlException: Connection Timeout Expired.
最近遇到了一个很奇葩的问题,我编写了一个.net core程序读取多个数据库数据源,进行数据同步处理.该程序在windows环境下运行完全正常,但在linux环境下运行报异常,提示 System.Da ...
- Windows服务 System.ServiceProcess.ServiceBase类
一.Windows服务 1.Windows服务应用程序是一种需要长期运行的应用程序,它适合服务器环境. 2.无用户界面,任何消息都会写进Windows事件日志. 3.随计算机启动而启动,不需要用户一定 ...
- [ScreenOS] How to manually generate a new system self-signed certificate to replace the expired system self-signed certificate without resetting the firewall
SUMMARY: This article provides information on how to manually generate a new system self-signed cert ...
- dotnet 修复找不到 System.ServiceProcess 定义
本文告诉大家如果复制网上一段代码发现 System.ServiceProcess 提示找不到方法或定义,需要手动添加引用 例如下面一段代码 using System.ServiceProcess; p ...
- error: could not create '/System/Library/Frameworks/Python.framework/Versions/2.7/share': Operation not permitted
参考: Python pip安装模块报错 Mac升级到EI Captain之后pip install 无法使用问题 error: could not create '/System/Library/F ...
- 解决报错"Your security system have blocked an application with expired or not yet valid certificate from running"
方法如下: Go to Control Panel Java in the Security tab click the "Edit Site List-" button clic ...
- Professional C# 6 and .NET Core 1.0 - Chapter 39 Windows Services
本文内容为转载,供学习研究.如有侵权,请联系作者删除. 转载请注明本文出处:Professional C# 6 and .NET Core 1.0 - Chapter 39 Windows Servi ...
- C# 6 与 .NET Core 1.0 高级编程 - 39 章 Windows 服务(下)
译文,个人原创,转载请注明出处(C# 6 与 .NET Core 1.0 高级编程 - 39 章 Windows 服务(下)),不对的地方欢迎指出与交流. 章节出自<Professional C ...
随机推荐
- Extjs动态增删组件
在项目中遇到要动态的增加删除一个组件,于是就查找资料,实现了下面的效果. Ext.onReady(function(){ // Ext.Msg.alert("提示","h ...
- 组播协议——IGMP v2报文头介绍
TYPE:占一个字节,其值有:0x16.0x12.0x17三种类型. Max Resp Time:最大响应时间,占一个字节. Checksum:校验和,占两个字节. Group address:组播地 ...
- Scrapyd 的远程部署和监控
1. 安装Scrapyd sudo pip3.6 install scrapyd # 安装scrapyd服务 sudo pip3.6 install scrapyd-client # 安装scrapy ...
- java 集合 Se HashTreeSet
Set接口 Set是Collection的子接口,与List相对 Set集合中的元素的特点是1,无序性 2,无下标3,无重复的元素 Set是个接口,所以无法直接创建对象,要依赖它的实现类来创建对象 ...
- 解题9(StringReversedOrder)
题目描述 将一个英文语句以单词为单位逆序排放.例如“I am a boy”,逆序排放后为“boy a am I”所有单词之间用一个空格隔开,语句中除了英文字母外,不再包含其他字符 接口说明 /** * ...
- CentOS7.x安装flash
1.配置 yum 源 sudo rpm -ivh http://linuxdownload.adobe.com/adobe-release/adobe-release-x86_64-1.0-1.noa ...
- oracle 调用包体的函数并返回return值
/// <summary> /// 执行数据库包体操作,返回结果 /// </summary> /// <param name="cmdText"&g ...
- php 更新array键值
$arr1 = array("loginname" => "username","psw" => "password& ...
- poj1308(并查集)
题目链接:http://poj.org/problem;jsessionid=436A34AE4BE856FB2DF9B264DCA9AA4E?id=1308 题意:给定一些边让你判断是否构成数. 思 ...
- 第十章 优先级队列 (a1)需求与动机