Question

I have a windows service written in C#. This service spawns a number of MTA threads. In each of those threads an out of process COM class is instantiated. I set the service to run as my current user (add the appropriate log in credentials). When the service starts it appears from Task manager that it is running as my user. If the service does a check for the local roaming user directory it returns my user directory as expected. When my COM class which is running as an out of process exe does this check, it returns a path in Windows\System32\Config\systemprofile\AppData\Roaming.

Can anyone shed some light on what is going on here, and even more specifically, how can I get the out of process server to run as the service user. I have checked in the task manager and according to task manager the exe is running as the same user (in the same session) as the service.

Not sure if the OS is a factor, but I have seen this on both Vista 32 (sp2) and Win7 64 (sp1)

Was it helpful?

Solution

You can get the server to run as a specific account using RunAs. Not very flexible but seems to do what you want here.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top