Attaching process to Windows Service

I have a windows service that has been built (VS 2005 Beta 2), installed and is running ( I am getting output in the event viewer, and part of it the service is working correctly).  But when I try to debug it using the "Attach to process", the service process is greyed out, and I am not allowed to attach to it. 
I am running Windows Xp Pro, SP2, as an admin.

Not sure if this is a security or permisson problem so I also have tried adding "Everyone" to the "impersonate a client after authentication" in the user rights assignments in local security settings, but it didn't help.

I installed the service using a Setup Project added to the solution.  I added the primary output to the application folder and then installed the service by right clicking the setup project (this is much easier than VS 2003).

Am I missing something
thanks

dh





Answer this question

Attaching process to Windows Service

  • EricN

    I am using C# and also cannot debug my windows service...


  • Barb O

    I can see the process when I check the "Show processes from all users" and it appears to attach but my break points are never reached.  When I "pause" the debugger it shows a green arrow on the line of code:

    System.ServiceProcess.ServiceBase.Run(ServicesToRun); 

    it says that this code has called into another function and when that function is finished this will be the next line to get executed...


  • Keith Henkel

    I figured out why it wasn't working. I assumed that the managed process type was the executable, but it wasn't.  To see the service executable you need to check the two boxes in the attach to process Show process from all users & Show processes in all sessions.  You should then see the executable for the service once you start the service.


    _________________________
    Brian Cauley
    Commpoint
    brian@commpoint.com.(Spam).please


  • Jim Fox

    I am using C#.  I tried the same project at work on a windows 2003 server machine and had the same problem.  The windows service process is greyed out on the screen.  I have fixed my service so this is not so urgent, but it would be nice to know how to get this working should it come up again.

    thanks

    dh

  • MMA_man

    You can't user the forms.timer in a service you have to user the system.threading.timer class.  Here is an example:

    System.Threading.Timer timer2;
    timer2 = new System.Threading.Timer(timer1_Ticks, null, 0, 10000);

    private void timer1_Ticks(object timerStatus)
    {
    Your timer code here
    }

    That should fix it.
    ________________________
    Brian Cauley
    Commpoint, Inc
    brian@commpoint.com.spam.remove


  • Chris Jiang

    I am having the same problem. I am using C#. When I try to attach to the process the attach is greyed out.  The process type is of Managed.  Any suggestions I am using the Release Version.
  • sirck sirck

    Need more info, message me on msn messenger at viperious@msn.com.spam.remove see if I can help ya

    _________________
    Brian
    Commpoint, Inc
    brian@commpoint.com

  • Vipin.B

    I found my problem!  My service was coded to execute during a timer_Tick event.  I dropped a timer control onto my Service class in design mode and that created a System.Windows.Forms.Timer....  It never fired... set Enable = true, started the timer, rewired up the event... nothing.  So, I deleted the timer and a programmatically added a System.Timers.Timer and used the timer_Elapsed event.  That solved my issue.

    Is this a bug   Can someone reproduce my results that the System.Windows.Forms.Timer does not work

    Thanks,

    KB
    < xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />


  • joostvaningen

    What language are you using That will help me route this to the correct forum so you get an answer.

    Neil

  • Attaching process to Windows Service