Debug Application from Service
-
Does anyone know if it's possible to debug a user application from a Windows service, or if there is something that prevents this? I suppose I could find out by just trying it, but I'd rather not waste time creating and installing a skeleton service just to see that it's not possible. I'm hoping someone might know one way or the other.
The difficult we do right away... ...the impossible takes slightly longer.
-
Does anyone know if it's possible to debug a user application from a Windows service, or if there is something that prevents this? I suppose I could find out by just trying it, but I'd rather not waste time creating and installing a skeleton service just to see that it's not possible. I'm hoping someone might know one way or the other.
The difficult we do right away... ...the impossible takes slightly longer.
Services run, by default, under the LocalService account, which is an extremely limited account. You can set your service to run as one of the predefined LocalService, NetworkService, or LocalSystem accounts, OR you can create your own account, assign privileges to it, and run your service under that account. Note that use of LocalSystem is not recommended, as it essentially gives your service access to anything on the platform! If you are running a debugger under a service, you may wish to allow the service to interact with the user. [Service User Accounts - Win32 apps | Microsoft Docs](https://docs.microsoft.com/en-us/windows/win32/services/service-user-accounts) [LocalService Account - Win32 apps | Microsoft Docs](https://docs.microsoft.com/en-us/windows/win32/services/localservice-account) [LocalSystem Account - Win32 apps | Microsoft Docs](https://docs.microsoft.com/en-us/windows/win32/services/localsystem-account) [NetworkService Account - Win32 apps | Microsoft Docs](https://docs.microsoft.com/en-us/windows/win32/services/networkservice-account) [Interactive Services - Win32 apps | Microsoft Docs](https://docs.microsoft.com/en-us/windows/win32/services/interactive-services)
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows. -- 6079 Smith W.
-
Does anyone know if it's possible to debug a user application from a Windows service, or if there is something that prevents this? I suppose I could find out by just trying it, but I'd rather not waste time creating and installing a skeleton service just to see that it's not possible. I'm hoping someone might know one way or the other.
The difficult we do right away... ...the impossible takes slightly longer.
-
Does anyone know if it's possible to debug a user application from a Windows service, or if there is something that prevents this? I suppose I could find out by just trying it, but I'd rather not waste time creating and installing a skeleton service just to see that it's not possible. I'm hoping someone might know one way or the other.
The difficult we do right away... ...the impossible takes slightly longer.
When writing a service, I always add a way to pass a command line parameter to run the app in debug mode as a console app. Many examples do the same thing. In other circumstances, you can attach to the service. Without the proper architecture, this can run into timeout issues.
-
When writing a service, I always add a way to pass a command line parameter to run the app in debug mode as a console app. Many examples do the same thing. In other circumstances, you can attach to the service. Without the proper architecture, this can run into timeout issues.
Thanks for your response. I was asking more about using the service as a debugger and having it attach to a user process.
The difficult we do right away... ...the impossible takes slightly longer.