首页 > 解决方案 > .Net 自定义服务无法启动

问题描述

我创建了一个自定义 Windows 服务,并尝试通过命令提示符启动它:

C:\Windows\system32>net START "CustomService"
The CustomService service is starting.
The CustomService service could not be started.

The service did not report an error.

More help is available by typing NET HELPMSG 3534.

我尝试查看 HELPMSG 3534。它指出:服务未报告错误。我不知道从这里去哪里。我试着用谷歌搜索这个,但没有什么真正有用的。我真的不知道如何解决这个问题。

Protected Overrides Sub OnStart(ByVal args() As String)
    SetConfigVariables()
    _logger.WriteMessageToLog(SimpleLog.LogType.InfoType, "Start Service")
End Sub

SetConfigVariables() 调用 sql server 并提取一些数据并设置适当的全局变量。

标签: asp.netwindowsservice

解决方案


问:你得到这个工作了吗?

建议:

如果没有,请确保您已完成本文中的所有操作,尤其是:

MSDN 演练:创建 Windows 服务应用程序

在运行 Windows 服务之前,您需要安装它,这会将其注册到服务控制管理器

还:

问:这个问题的情况如何:Accessing Config File From Web - No AppSettings


推荐阅读