Announcement

Collapse
No announcement yet.

Cannot successfully start service

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Cannot successfully start service

    My call to create the service works as I see the service was properly created. When I try to start it in the next line, though, it does not start, but rather gets a 3406 ("The start command failed.") error.

    Code:
    function InstallAndStartService()
    	PathOfExe = SessionVar.Expand("%AppFolder%").."\\".."EcFtpClient.exe";
    	NetworkService = "NT AUTHORITY\\NETWORK SERVICE";
    	File.SetPermissions(SessionVar.Expand("%AppFolder%"), System.GetUserSID(NetworkService), GRANT_ACCESS, ALL_PERMISSIONS, SUB_CONTAINERS_AND_OBJECTS_INHERIT);
    
    	[B]Service.Create[/B](PathOfExe, ServiceDisplayName, ServiceKeyName, SERVICE_WIN32_OWN_PROCESS, false, SERVICE_AUTO_START, SERVICE_ERROR_NORMAL, "", "", nil, NetworkService, "");
    	[b]Service.Start[/B](ServiceDisplayName, ServiceKeyName);
    
    	Dialog.Message("Error starting service",Application.GetLastError());  --shows 3406
    end
    After the installer finishes running, I can start the service manually and it works fine. I've tried adding a 5000ms delay between the Create and Start line but that didn't help, either. I've also tried removing the "KeyName" being passed to the Start command, but that didn't help, either.

    Please advise.

    Thanks,
    Eliezer

  • #2
    I found the answer. I was trying to start the service from a "before install" "On Next" screen. When I moved the call to start the service to an "after install" "pre-load" screen it worked. I don't really understand why it's like this, but I did notice that my EXE file (that of the service) is only copied to the AppFolder at that point...

    Comment

    Working...
    X