且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

C# Windows 服务——本地计算机上的服务启动然后停止?

更新时间:2022-03-15 21:59:28

检查以确保运行服务的帐户可以访问这些文件(包括对 .wav 和 .mp3 文件的写访问权限).

Check to make sure the account your service runs under can access those files (including write access for the .wav and .mp3 files).

您的代码也可能导致未处理的异常.我不确定,但这可能在事件日志中可见.您还可以让您的服务将消息显式地写出到事件日志中(例如在发生异常的情况下);查看此链接:http://www.codeproject.com/KB/dotnet/simplewindowsservice.aspx

Your code might also be causing an unhandled exception. I'm not sure, but that might be visible in the event log. You can also get your service to write out messages explicitly to the event log (like in the case of an exception); check out this link: http://www.codeproject.com/KB/dotnet/simplewindowsservice.aspx