问题
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