How to use DebugView for Windows Service

How many times we wanted to debug our windows application in a log  during runtime. Most of us will use Log4Net and many other utilities to log the events or exceptions caused in Event Viewer or some temporary log files. Well Windows Systinternals provide an viewer to get messages at runtime when a windows service is running known as Debugview. Let me show you how we can achieve that.

First download the viewer and unzip the content.


Lets create a Windows Service using .NET IDE.


Lets add an installer to the service first by right-clicking the service design.


Now lets add a bit of code to display some numbers 1 – 10 once the service starts. In order to display the number in customized format I am writing the following lines of code

protected override void OnStart(string[] args)
    for (int i = 0; i < 10; i++)
        Debug.WriteLine("New Count " + i);

Now lets install the service and run the service manually along with the debugview. Before you start the installation make the ProcessInstaller Account property to LocalSystem so that you don’t get any prompt to supply Username and Password for the Service. If you have created the service using VS2013, run the Developer Command Prompt for VS2013 which you will find under “C:Program Files (x86)Microsoft Visual Studio 12.0” under Adminstrator Mode. Else you might encounter Access Denied Error similar to like this “cannot open service control manager on computer”.

Install the service using Installutil command


Once installation is successful, Open Service Control Manager and run the service manually. Also run the Debugview that you had just downloaded in Administrative mode. This is what get displayed in DebugView






  1. Hi Joy,

    Hope you remember me :)… I was going through your blog and found this interesting article. But images are not available, so can you please correct it. So that it will be faster & easy for people to understand by images.


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

This site uses Akismet to reduce spam. Learn how your comment data is processed.