问题
I created a wcf library. then i write wcf service which do create or open a file and writes "hello world" in that file. then i added new project to add windows service. in that windows service onstart() method i call the wcf service. then i build and installed the service using installutil. the service was installed successfully. while i am starting the service in services.msc, it shows the following error
"the service on local computer started and then stopped some services stopped automatically. if they have no work to do, for example the performance logs, and alerts."
why am i getting this error. how to resolve this?
回答1:
(i)Clear the Application Log.
(ii)Use the debugger and trace the execution of the OnStart() method.
if these does not work,
1) Click Run Command from start button
2) Enter Services.msc then click OK,you will get all the services in your computer.
3) Select your service and right click on the service and select Properties
4) Goto Logon Properties a select Local System Account then click OK
来源:https://stackoverflow.com/questions/19063442/cannot-start-the-windows-service