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 ...
随机推荐
- 多线程数据库查询(ADO)
ADO多线程数据库查询通常会出现3个问题: 1.CoInitialize 没有调用(CoInitialize was not called):所以,在使用任何dbGo对象前,必须手 调用CoIniti ...
- 修改Http消息的消息头Host
在 HttpURLConnection 类中直接使用如下代码无法修改Host的值: connection.setRequestProperty("Host", host); 需要在 ...
- 吴裕雄 python深度学习与实践(4)
import numpy,math def softmax(inMatrix): m,n = numpy.shape(inMatrix) outMatrix = numpy.mat(numpy.zer ...
- Incompatible shapes during the half way training---Invalid argument: Incompatible shapes: [1,63,4] vs. [1,64,4]
这是tensorflow model 中我使用它的faster--cnn,但是就是训练过程中,代码执行到一半 一般是step=40~120的时候就报错了: INFO:tensorflow:global ...
- led 的 platform驱动实现
http://www.linuxidc.com/Linux/2014-03/97756.htm http://blog.sina.com.cn/s/blog_6b94d5680101cn0t.html ...
- 阿里大于发送短信(java)
一.短信签名设置 1.短信签名是什么? 签名是在短信内容开始或者末尾跟的品牌或者应用名称,设置签名有一下几个好处:增加品牌的曝光度,增强用户的记忆让用户能更清楚的知道正在使用的应用. 2.签名可不可以 ...
- linux下各权限的细分
PS:有时候你发现用root权限都不能修改某个文件,大部分原因是曾经用chattr命令锁定该文件了.chattr命令的作用很大,其中一些功能是由Linux内核版本来支持的,不过现在生产绝大部分跑的li ...
- webstocket 聊天
/** * 初始化socket **/ function initSocket(index_host){//端口号 if( !window.WebSocket ){ console.log(" ...
- 外购半成品报SHORT问题(验货客户)
描述:下图中可以看到外购半成品层物料报SHORT 2.开始检查数据 --针对外购半成品(外购半成品的成品层有BOM数据,外购半成品没有BOM数据) '; --select * from TB_ADDB ...
- vps vultr centos7 搭建 伟皮恩
vultr 配置 64 bit OS CentOS 7 ×64 20 GB SSD 1 CPU 512MB Memory 500GB Bandwidth √ Enable IPv6 √ ...