O'Reilly logo

Microsoft® Visual Basic® .NET Programmer's Cookbook by Matthew MacDonald

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Debug a Windows Service

Problem

You want to debug a Windows service in Visual Studio .NET (watch debug messages, use variable watches and breakpoints, and so on).

Solution

Start the Windows service through the SCM as you would ordinarily, and attach the Visual Studio .NET debugger manually.

Discussion

You can’t run a Windows service from the Visual Studio .NET integrated development environment (IDE) because Windows services can be executed only by the SCM. However, you can start the Windows service through the SCM, and then attach the debugger.

To debug a Windows service, follow these steps:

  1. Load the source code for the project into Visual Studio .NET.

  2. Install the service if necessary, and then start it using the Computer Management console. (See recipe ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required