Objects in this mirror are closer to Microsoft Technologies. DNM objective is to help users on Microsoft technologies by providing Articles, snippets, Interview Questions.

25 July 2012

windows service is not listing in attach to process window in Visual studio

You have registered your windows service in the services.msc and its running successfully. When the service is running it shows in the task manager.

Err:
If you want debug the window service code, few times it will not show in available process under attach to process window from debugger.
The root cause could be your service is running under local service or system account not by your user account. In Attach to process window, by default the available process will show the processes which are running under your account name.
So in order to resolve the issue please do the following step.
Sol:
Make sure that you are running the visual studio as an administrator and from the attach process window (Debug à Attach to Process) select the checkbox ‘show process from all users’ in the available process section.
Note: If you have small piece of code in Onstart method. By the time you have attached the service the code execution might complete so try to add code Thread.Sleep(3000).

0 Comments:

Post a Comment