Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 661771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T23:18:15+00:00 2026-05-13T23:18:15+00:00

I have a Windows Service and I would like to see what it’s doing

  • 0

I have a Windows Service and I would like to see what it’s doing when it starts up. Normally to accomplish something like that, I’d hard-code a Thread.Sleep for like 10 seconds to give me enough time to attach the debugger. This is effective, but annoying, as I need to re-compile once to put the pause in and again when I (hopefully remember to) take the pause out. I know I could alternatively hard-code a break command in, but that also requires me to re-compile my solution.

I know I can also separate my service’s logic into a separate project that can be run in Visual Studio, which I can use most of the time, but sometimes I want to see exactly what my service is doing when it’s running as a service.

Is there a way that I can get my debugger attached to my service so that I can see the things it’s doing on startup, without hard-coding and re-compiling anything?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T23:18:15+00:00Added an answer on May 13, 2026 at 11:18 pm

    There is a registry key which gives you a chance to attach a debugger to the process as soon as it is created.

    Save the following snippet as a *.reg file and import to your registry:

    Windows Registry Editor Version 5.00
    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\services.exe]
    "Debugger"="c:\\Program Files\\Debugging Tool For Windows\\windbg.exe"
    

    remember to change ‘services.exe’ to the actual services executable file name.

    You can also use the gflag tool to facilitate the work. For detailed information please check KB 824344: How to debug Windows services

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a .NET Windows service and a .NET Web Application that I would
I have a windows service written in C# .NET framework 3.5 and would like
I have a Windows service that writes messages to the Event Log. I also
I have a windows service that does some intensive work every one minute (actually
I have a basic C# console application that I would like to run as
I have a Windows Service that monitors a COM port connected to a vendors
I have a Windows service running in local system that simply keeps trying to
I have a windows service that is installed using a setup project. Things work
I have a Windows Service that I am writing in .NET C#. The service
I have a program that runs as a Windows Service which is processing files

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.