in

ASP.NET Weblogs

Ian Stallings: web log

official chicken™

January 2004 - Posts

  • Installing a Windows Service CORRECTLY

    Ok so I posted how I installed my windows service yesterday only to witness my own lack of understanding drive by me waving as it drove into the distance. Thanks to some good feedback here I have now fixed my project and the windows service installs properly now. It was an easy fix because I already had an installer class in my project (http://staff.develop.com/candera/selfinstall.htm). All I had to do was delete the custom actions I had created improperly before (see my last blog post) and then create two new custom actions. One for Install using the output from my service project, and adding one argument  /install. I do the same for unistall but use the /unistall argument.

    Thanks for all the feedback! It really helped me.

  • Installing Windows Service Using .msi

    When I created a windows service using .Net I also created an installer project using VS.net 2002's built in setup project. This worked fine if all I wanted to do was copy my service.exe and service.config file to the target machine but the user would still have to run the InstallUtil utility provided by Microsoft to install the service itself. After searching on the web I didn't find anything about how to accomplish this so I thought I'd share how I did it:

    In my setup project I added the InstallUtil.exe to my target files under Application Folder along with it's .config file. Under custom actions I created a custom action for Install. I call InstallUtil.exe and set the Arguments property to "[TARGETDIR]\service.exe". Then I set the InstallerClass property to False. I do the same thing for the Unistall but I set the Arguments property to /u "[TARGETDIR]\services.exe".

    * warning *
    Now that all being said it will work fine if the service is not already installed. If it is the InstallUtil.exe will throw an error and the install will fail. Easy to work around but only the developer will know why and how to fix it.

    Everyone - Please let me know if you come up with a better or easier way to accomplish this.

  • Debugging Windows Services

    For anyone working on a windows service using .Net I advise you to read this article first. It will help you debug your application and alleviate a lot of headaches. Good stuff.
More Posts