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 ...
随机推荐
- Haskell语言学习笔记(75)Conduit
安装 conduit $ cabal install conduit Installed conduit-1.3.0.3 Prelude> import Conduit Prelude Cond ...
- 一个神奇的BUG :Failed to finalize session : INSTALL_FAILED_INVALID_APK: /data/app/vmdl99393454.tmp/10_slice__ signatures are inconsistent
Android Studio 在Gradle编译完成后安装APK时总是失败,EventLog提示如下信息: Failed to finalize session : INSTALL_FAILED_IN ...
- c3 新特性
渐变 线性渐变 .line { height: 100px; /*线性渐变语法*/ background-image: linear-gradient( to right,/* ...
- SPSS-判别分析
判别分析 判别分析是一种有效的对个案进行分类分析的方法.和聚类分析不同的是,判别分析时组别的特征已知. 定义:判别分析先根据已知类别的事物的性质,利用某种技术建立函数式,然后对未知类别的新事物进 行判 ...
- numpy 矩阵变换 reshape ravel flatten
1. 两者的区别在于返回拷贝(copy)还是返回视图(view),numpy.flatten()返回一份拷贝,对拷贝所做的修改不会影响(reflects)原始矩阵,而numpy.ravel()返回的是 ...
- mybatis in查询 传入string
<select id="selectChoosenumberdetailNumber" > SELECT number FROM choosenumberdetail ...
- MySql介绍
MySql介绍 标签(空格分隔): MySql MySQL是一个关系型数据库管理系统,由瑞典MySQL AB 公司开发,目前属于 Oracle 旗下公司.MySQL 最流行的关系型数据库管理系统,在 ...
- 一、Iterator 迭代器
需求:如何不适用for循环,依次遍历出数组中每个元素? 设计原理: 代码清单: 接口类 public interface Iterator { boolean hasNext(); Object ne ...
- day28 网络协议OSI 及socket模块
反射都是操作对象中的__dict__的内容 class Student: def study(self): print("正在学习....") stu = Student() if ...
- python3 获得shell的输出内容(subprocess.getstatusoutput)
默认通过os.system(“shell")命令赋值,结果是0之类的,0表示shell命令运行正确 如果想获得shell输出的内容,可以通过[subprocess.getstatusoutp ...