Recently I have to debug a .net windows service I wrote in dev studio 2005. I found this nice article on MSDN about .net windows service debugging.

However when I tried to attach to the running service, the process that has my service name is grayed out in the dev studio debugger and I can attach to it. After examining it more carefully, I realized that this is actually the hosting process CpsPowerMgrService.vhost.exe instead of the service executable CpsPowerMgrService.exe. And the hosting process is running under the current user instead of the local service account I specified for the service.

So where is my service process?

It turns out that I need to check the process in all sessions option and then my real service process showed up. And it is running in a different session as you can see from the session ID column. Now the dev studio allows me to attach to the real process.

I am not sure how useful the hosting process is in this scenario. It seems to only cause unnecessary confusion. It may be a good question for Microsoft. idea, anyone?

This link explains the hosting process feature in dev studio

http://msdn2.microsoft.com/en-us/library/ms185331(VS.80).aspx

would have included some screen shots. But I still haven figured out how to add images to this blog site. Yes, I tried and it is frustrating. I will post screen shots when I can.