unable Debug a service in VS2005 on windows7 RRS feed

  • Question

  • Hi,

    I have windows service project in VS2005 which was developed on XP platform. For Debugging i used the following code

        #if (DEBUG)

    This worked fine and it opened up dialog to select the instance of Visual Studio that has the Windows Service project open and i could debug it.

    Now i have the same project moved to a system with windows7. The dialog doesnt seem to open. Is there anyway i can get the debugging happen.



    Friday, August 13, 2010 7:08 PM


  • Hello,

    Thanks for your thread and welcome to Visual Studio Debugger forum!

    The first thing you may check is if you set Configuration Manager to Debug mode in your new environment in Visual Studio, this is because the code snippet works only in debug mode.

    To get Visual Studio Just-In-Time Debugger open, please intall and run you service. Also, please check if you have a JIT debugger in registry entry (32bit machine):
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug\Debugger

    By default, a windows service project can not debug from  within Visual Studio IDE directly. But there are a couple of workarounds:
     1. install and run the service firstly and using attach to process dialog box.
     2. add a little bit more code to let the thread sleeps while debugging in Visual Studio.
    Please take a look at this article and its comments to get more information.

    Best regards

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    If you have any feedback, please tell us.
    Welcome to the All-In-One Code Framework!
    • Marked as answer by liurong luo Friday, August 20, 2010 7:35 AM
    Monday, August 16, 2010 2:32 AM