简体   繁体   English

Windows服务无法停止

[英]windows service cannot stop

Created a simple WCF service that basically logs to a db. 创建了一个简单的WCF服务,该服务基本上记录到了db。 the build is fine and created a msi install file for it. 构建良好,并为此创建了一个msi安装文件。 I installed the windows service and start it which works, however when i stop it i get this error: 我安装了Windows服务并启动了该服务,但是当我停止它时,出现此错误:

"Could not stop the service1 service on local computer. The service did not return an error. This could be an internal windows error or an internal service error. If the problem persists, contact your system administrator." “无法在本地计算机上停止service1服务。该服务未返回错误。这可能是内部Windows错误或内部服务错误。如果问题仍然存在,请与系统管理员联系。”

There are a couple of ways to diagnose this: 有两种诊断方法:

If you haven't already, separate out the implementation of the windows service from the actual service executable. 如果还没有,请从实际的服务可执行文件中分离出Windows服务的实现。 That way you can run / debug the code from a console or forms app easily. 这样,您可以轻松地从控制台或Forms应用程序运行/调试代码。

If that doesn't reveal any answers, add verbose logging to the shutdown method to find out what is happening. 如果仍然无法解决问题,请在关闭方法中添加详细的日志记录,以查找正在发生的情况。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM