PTC MKS Toolkit Knowledge Base

Product:MKS Toolkit (TKPDev/TKEDev)
Keywords:porting, Windows service
Category:Porting/Knowledge Base

Why does my program run fine from the command line, but fail when run as a service?

This is most likely an issue with the security context under which the application runs. By default, services run as NT Authority\System. This account has limited access to system resources (e.g., the file system). Please see the Debugging a Service section of the Porting Daemons chapter of the UNIX to Windows Porting Guide to learn how to determine what is failing. Once you understand the cause, the solution may be to change the security context of the service, either programmatically or via the control panel.