Coffeehouse Post

Single Post Permalink

View Thread: Windows Services Problem
  • User profile image
    Ion Todirel

    i have a Windows Service (default settings), with this code inside OnStart method:

    protected override void OnStart(string[] args)
    tw = new StreamWriter(@"C:\test_service.txt", true);
    .WriteLine("Service started at: " + DateTime.Now.ToString());

    in ServiceProcessInstaller, Account = LocalService (or NetworkService), what code should i have in OnStart method to run service? (without warning: The ... service on Local Computer started and then stopped. Some services stop automatically if they have no work to do. for example, the Performance Logs and Alerts service.)

    don't tell me change Account to LocalSystem.