Debugging a Windows Service using Visual Studio .NET 2005(wijix.com)

submitted by pjacobspjacobs(375) 4 years, 10 months ago

Demonstrate how to allow Windows Services to be debugged using Visual Studio .NET 2005

4 comments |category: |Views: 56

tags: another

new Add a live kick counter to your blog >> liveImage

You can even customize the image by choosing your own colors, and then clicking the button below to update the preview and the html code:

  • "Kick It" text
  • "Kick It" background
  • kick count text
  • kick count background
  • border

Simply copy and paste this HTML into your blog post.


Users who kicked this story:
Comments:

posted by yesthatmcgurkyesthatmcgurk(4063) 4 years, 10 months ago 0

Schwa? That's freaky. How about replacing that infinite loop with this simple line:

#if(DEBUG)
System.Diagnostics.Debugger.Launch();
#endif

When you start the service it'll ask if you want to attach. Attach with a currently running instance of VS with the service's project open. Simple as that.

Reply

posted by yesthatmcgurkyesthatmcgurk(4063) 4 years, 10 months ago 0

Oh, and for ease of starting, stopping, installing and uninstalling the service I have four batch files I keep in the bin/debug directory of the service. Just open a Visual Studio command window (you need the environmental variables set correctly; cmd.exe won't do it for you) and browse to your debug directory.
go.bat:
net start [your service name]
stop.bat:
net stop [your service name]
install.bat:
installutil.exe [your service filename]
uninstall.bat:
installutil.exe /uninstall [your service name]

Reply

posted by yesthatmcgurkyesthatmcgurk(4063) 4 years, 10 months ago 0

sorry, last one should be service filename. Filename is easy to discover. To find (or change) your service name, open your service in the designer. You should see a blank, gray designer surface with "To add components to your class yadda yadda blabety blah" on it. Right click on the surface and select Properties. Your service name is at the bottom of the property editor.

Reply

posted by yesthatmcgurkyesthatmcgurk(4063) 4 years, 10 months ago 0

Four! Four comments! Ha hah hah hah hah!

Reply

information Login or create an account to comment on this story