Debugging Windows Service

Posted: May 12, 2011 in .Net4.0

Add the following line System.Diagnostics.Debugger.Break(); in the OnStart() method of Service. Compile in debug mode,install the windows service using installutil from command prompt and start the service.When you start the service, you will be prompted to debug the process. Select the Visual Studio debugger.It will take you to the service and you can debug accordingly.If you want to modify any code,Just stop it,modify the code,compile and re-start service.Hope this helps 🙂

  1. Joy says:

    Yes this really helps!!!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s