windows service not executing OnStart entry point

醉酒当歌 提交于 2019-12-25 04:41:03

问题


I have a windows service installed,

Some.WindowsService wService = new WindowsService();
Some.Server server = new Server();
Some.Service service = new Service();
Some.Request request = new Some.Request(msg, Id);
var ReturnedResult = server.Execute(request);

I checked in Service, the "Some" is running in Service normally. I don't know how to initialize so that I can reach the protected OnStart() function in WindowsService, and so that it can call the functions in OnStart() Function.

Any idea are appreciated. Thanks a lot. : )


回答1:


One way you can test this is write a log file or the windows event log

System.Diagnostics.EventLog appLog = 
    new System.Diagnostics.EventLog() ;
appLog.Source = "This Application's Name";
appLog.WriteEntry("An entry to the Application event log.");


来源:https://stackoverflow.com/questions/19410227/windows-service-not-executing-onstart-entry-point

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!